otel-migration
БесплатноБез исполняемых скриптовНе проверенRetrofitting OpenTelemetry into an existing, uninstrumented application. Trigger phrases: "migrate existing app to OTel", "add OpenTelemetry to existing…
от honeycombio★ 28 звёзд на GitHubОб этом скилле
OpenTelemetry Migration for Existing Applications
Guide for retrofitting OpenTelemetry into an existing, uninstrumented application. This covers the phased migration approach, context propagation refactoring, logging and metrics bridges, and verification. This is distinct from greenfield OTel setup (see otel-instrumentation skill) and Beeline-specific migration (see beeline-migration skill).
When to Use This Skill
Use this skill when the user has an existing application that:
- Has no OpenTelemetry instrumentation and needs to add it
- Has existing logging, metrics, or context patterns that must coexist with OTel
- Needs to refactor function signatures to thread trace context through the call stack
- Uses a framework with OTel middleware gotchas (e.g., Fiber, Gin, Express)
For greenfield OTel setup, use the otel-instrumentation skill instead.
For Beeline-to-OTel migration, use the beeline-migration skill instead.
For understanding why to instrument, see the observability-fundamentals skill.
Migration Phases
The migration follows six phases in order. Each phase is independently deployable and verifiable. Context propagation (Phase 3) is typically ~60% of the effort.
Phase 1: SDK Initialization and Shutdown
Set up TracerProvider, MeterProvider, and LoggerProvider with OTLP exporters. Wire initialization early in the application's entry point and shutdown in signal handlers.
Key guidance:
- SDK init must happen before any application code that might create spans — one of the first things in your entry point, before config loading or storage initialization
- Shutdown ordering matters: flush traces, then metrics, then logs. Use a timeout (10-30s)
- If init fails, the application should still work — log the error and continue without telemetry
- For language-specific SDK setup, consult
${CLAUDE_PLUGIN_ROOT}/skills/otel-instrumentation/references/sdk-setup-by-language.md
Phase 2: HTTP Middleware (Auto-Instrumentation)
Add OTel middleware to your HTTP framework. This gives you automatic spans for every inbound request with zero code changes to handlers. This is the highest-ROI step.
Critical: Different frameworks expose the OTel-enriched context differently. This is the #1
source of silent trace breaks. Consult
${CLAUDE_PLUGIN_ROOT}/skills/otel-migration/references/framework-middleware.md for
framework-specific details.
| Framework | How to get OTel context | Common mistake |
|---|---|---|
| Go net/http | r.Context() |
N/A (standard) |
| Go Fiber v2 | c.UserContext() |
Using c.Context() (returns fasthttp context without OTel span) |
| Go Gin | c.Request.Context() |
Using c directly |
| Go Echo | c.Request().Context() |
N/A |
| Python Flask | Automatic (thread-local) | N/A with instrumentation library |
| Python Django | Automatic (thread-local) | N/A with instrumentation library |
| Node.js Express | Automatic (AsyncLocalStorage) | N/A with instrumentation library |
| Java Spring | Automatic (thread-local) | Thread pool context loss |
| .NET ASP.NET Core | Automatic (AsyncLocal) | N/A |
| Ruby Rails | Automatic (thread-local) | N/A with instrumentation library |
Phase 3: Context Propagation Refactoring
Thread trace context through your call chain from HTTP handlers (or entry points) down to I/O operations. This is the hardest phase — typically ~60% of migration effort.
The difficulty of this phase varies dramatically by language:
- Go: Hardest. Requires adding
context.Contextparameter to every function in the call chain. - Java: Moderate. Thread-local context propagates automatically within a thread, but breaks across thread pools, CompletableFuture, and reactive streams.
- Python: Easier.
contextvarspropagates automatically within a thread. Pain points are thread pools and multiprocessing. - Node.js: Easier.
AsyncLocalStoragepropagates through async/await automatically. Pain points are old callback-based code. - .NET: Easiest.
Activitypropagates through async/await viaAsyncLocal<T>automatically. - Ruby: Easier. Thread-local context propagates automatically. Pain with manual thread creation.
For language-specific patterns and code examples, consult
${CLAUDE_PLUGIN_ROOT}/skills/otel-migration/references/context-propagation-patterns.md.
Phase 4: Custom Spans
Add spans to business logic operations that auto-instrumentation doesn't cover. Defer to the
otel-instrumentation skill for span creation mechanics. Migration-specific guidance:
- Start with I/O boundaries — database calls, external HTTP calls, cache operations
- Then add business logic — operations that explain why time is spent
- Add attributes liberally — every piece of context makes BubbleUp useful during investigations
- Record outcomes on spans — result status, error count, duration as attributes
For attribute naming and span creation patterns, consult `${
Установить otel-migration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл otel-migration?
Retrofitting OpenTelemetry into an existing, uninstrumented application. Trigger phrases: "migrate existing app to OTel", "add OpenTelemetry to existing project", "retrofit OTel into my codebase", "thread context through my code", "context propagation", "bridge Prometheus metrics to OTel", "logging bridge", "migrate logging to OTel", "slog bridge", "logback bridge", "verify my instrumentation", "traces are disconnected", "orphaned spans", "migrate to OpenTelemetry", "OTel migration plan", "how do I sequence an OTel migration", "add tracing to existing code", "refactor for context propagation", "Fiber context gotcha", "keep existing logging working with OTel", "add OTel without breaking Prometheus", "bridge existing metrics", "coexist with existing monitoring". For greenfield instrumentation use otel-instrumentation; for Beelines use beeline-migration.
Как установить скилл otel-migration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл otel-migration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic