Command Palette

Search for a command to run...

Назад к скиллам
скилл № 04471

OpenTelemetry Instrumentation Extension

Extend OpenTelemetry instrumentation when new functionality is added to the MCP Gateway. Use when (1) new operations/functions are added, (2) reviewing code…

БесплатноБез исполняемых скриптов
dockerот docker★ 1 658 звёзд на GitHub19 установок в других каталогах

Установить OpenTelemetry Instrumentation Extension в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

OpenTelemetry Instrumentation Extension

Automatically extend OpenTelemetry instrumentation for new functionality in the MCP Gateway, following established patterns documented in docs/telemetry/README.md.

When to Use This Skill

Automatically apply when:

  • New state-changing operations added (Create, Update, Delete, Push, Pull, Add, Remove, etc.)
  • New CLI commands added to cmd/docker-mcp/
  • New packages with operations in pkg/
  • User mentions "otel", "telemetry", "instrumentation", "metrics", or "tracing"
  • Code changes that modify state (database, files, containers, configuration)
  • Reviewing code for telemetry coverage

Workflow

Phase 1: Analysis & Suggestion

  1. Read project telemetry standards:

    • Read docs/telemetry/README.md "Development Guidelines" section
    • Read pkg/telemetry/telemetry.go to understand existing patterns and metrics
  2. Identify scope using git diff:

    • Find new/changed files in pkg/ and cmd/docker-mcp/
    • Identify functions performing state-changing operations
    • Infer domain from package structure (e.g., pkg/foo/ → domain: foo)
  3. Categorize findings:

    • Operations in existing domains (use existing metrics)
    • Operations in new domains (need new metrics)
  4. Present suggestions to user:

    • List each function needing instrumentation with file:line reference
    • Specify operation type (create, update, delete, etc.)
    • Identify domain and whether metrics exist
    • Show what will be added (instrumentation code, metrics, docs, tests)

Phase 2: Implementation (After User Approval)

Execute in this order:

  1. Make changes: Instrument operations and add metrics to pkg/telemetry/telemetry.go
  2. Verify: Build, run with OTEL collector, check docker logs otel-debug output
  3. Write tests: Add tests to pkg/telemetry/telemetry_test.go
  4. Update docs: Add metrics/operations to docs/telemetry/README.md
  5. Run tests: Execute make test
  6. Final verification: Run ./docs/telemetry/testing/test-telemetry.sh

Key Principles

Follow the project's documented guidelines from docs/telemetry/README.md:

  1. Use Existing Providers: Get global tracer/meter from OTEL
  2. Preserve Server Lineage: Include server attribution in all telemetry
  3. Non-Blocking Operations: Telemetry never blocks or fails operations
  4. Debug Support: Add logging behind DOCKER_MCP_TELEMETRY_DEBUG
  5. Follow Naming Conventions: Use mcp.<domain>.<field> pattern
  6. Deferred Success Tracking: Only set success on clean completion

Where to Find Information

ALWAYS read these files before suggesting changes:

  1. docs/telemetry/README.md - Source of truth for:

    • Development guidelines (lines 419-474)
    • Existing metrics and attributes
    • Testing procedures
    • Naming conventions
  2. pkg/telemetry/telemetry.go - Understand:

    • Existing metric instruments
    • Recording function patterns
    • Helper functions for spans
    • Init() structure
  3. pkg/telemetry/telemetry_test.go - See:

    • Testing patterns
    • How to verify metrics

Instrumentation Pattern

Use the simple defer pattern from cmd/docker-mcp/catalog/create.go:

func OperationName(ctx context.Context, identifier string, ...) error {
    telemetry.Init()
    start := time.Now()
    var success bool
    defer func() {
        duration := time.Since(start)
        telemetry.Record<Domain>Operation(ctx, "operation_name", identifier,
            float64(duration.Milliseconds()), success)
    }()

    // ... operation logic ...

    // Optional: Record resource counts
    telemetry.Record<Domain><Resources>(ctx, identifier, int64(count))

    success = true
    return nil
}

Note: If identifier is generated during execution, the defer captures its final value.

Adding New Domains

When instrumentation is needed for a new domain (e.g., new package pkg/newdomain/):

1. Add Metric Instruments in pkg/telemetry/telemetry.go

In the Init() function, add global variables and create metric instruments:

var (
    // ... existing metrics ...

    // New domain metrics
    newdomainOperations        metric.Int64Counter
    newdomainOperationDuration metric.Float64Histogram
    newdomainResources         metric.Int64Gauge  // If managing resources
)

func Init() {
    // ... existing init code ...

    newdomainOperations, _ = meter.Int64Counter(
        "mcp.newdomain.operations",
        metric.WithDescription("New domain operations count"),
    )
    newdomainOperationDuration, _ = meter.Float64Histogram(
        "mcp.newdomain.operation.duration",
        metric.WithDescription("New domain operation duration in milliseconds"),
    )
    newdomainResources, _ = meter.Int64Gauge(
        "mcp.newdomain.resources",
        metric.WithDescription("Number of resources in new domain"),
    )
}

2. Add Recording Functions in pkg/telemetry/telemetry.go

After the Init() function, add reco

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл OpenTelemetry Instrumentation Extension?

Extend OpenTelemetry instrumentation when new functionality is added to the MCP Gateway. Use when (1) new operations/functions are added, (2) reviewing code for missing instrumentation, (3) user requests otel/telemetry additions, or (4) working with state-changing operations. Analyzes git diff, suggests instrumentation points following project standards in docs/telemetry/README.md, implements with approval, writes tests, updates documentation, and verifies with debug logging and docker logs.

Как установить скилл OpenTelemetry Instrumentation Extension?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл OpenTelemetry Instrumentation Extension запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить OpenTelemetry Instrumentation Extension с