opensearch-project/agent-health/instrument-otel
Claude Code and agent skill by opensearch-project/agent-health
- community
Checking that the SKILL.md file is still in the repository.
Use when instrumenting an application with OpenTelemetry for Agent Health. Provides span structure, required attributes, and config setup for routing traces.
Install
npx vskill@latest install opensearch-project/agent-health/instrument-otelSKILL.md
Task: Instrument with OpenTelemetry for Agent Health
Add OpenTelemetry instrumentation following GenAI semantic conventions so traces are compatible with Agent Health.
Steps
- Install OTel dependencies for the project's language (Python:
opentelemetry-api,opentelemetry-sdk,opentelemetry-exporter-otlp-proto-http; Node.js:@opentelemetry/api,@opentelemetry/sdk-node,@opentelemetry/exporter-trace-otlp-http)
- Initialize tracer with OTLP exporter pointing to
OTEL_EXPORTER_OTLP_ENDPOINTusinghttp/protobufprotocol
- Create spans in this hierarchy:
`` Root: invoke_agent (gen_ai.operation.name = "invoke_agent") ├── chat (gen_ai.operation.name = "chat") ├── execute_tool (gen_ai.operation.name = "execute_tool") └── ... ``
- Set required attributes:
Agent root span:
gen_ai.operation.name:"invoke_agent"gen_ai.agent.name: agent namegen_ai.system: provider (e.g.,"aws.bedrock","openai","anthropic")gen_ai.conversation.id: unique run/session ID (links the trace to an Agent Health run; also accepted asagent_health.run.id.gen_ai.request.idis not a registered attribute — don't use it)
LLM spans:
gen_ai.operation.name:"chat"gen_ai.request.model: full model ID (e.g.,"anthropic.claude-sonnet-4-20250514-v1:0")gen_ai.usage.input_tokens: integergen_ai.usage.output_tokens: integer
Tool spans:
gen_ai.operation.name:"execute_tool"gen_ai.tool.name: tool name
- Set environment variables to emit traces:
``bash export OTEL_TRACES_EXPORTER=otlp export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf export OTEL_EXPORTER_OTLP_ENDPOINT=<YOUR_OTLP_ENDPOINT> export OTEL_SERVICE_NAME=my-agent ``
- Configure Agent Health to read traces from the OpenSearch domain:
Option 1: CLI (recommended) ``bash npx @opensearch-project/agent-health setup-telemetry ` This writes the observability config to agent-health.config.json` automatically.
Option 2: Manual JSON config Add to agent-health.config.json: ``json { "observability": { "endpoint": "https://search-my-domain.us-west-2.es.amazonaws.com", "authType": "sigv4", "awsRegion": "us-west-2", "awsService": "es", "tracesIndex": "otel-v1-apm-span-*" } } ``
- Verify with
npx @opensearch-project/agent-health doctor
Key Rules
- Token counts MUST be integers, not strings
- Always call
span.end()(or use context manager) - Use full model IDs (e.g.,
anthropic.claude-sonnet-4-20250514-v1:0), not short names - Every span needs
gen_ai.operation.nameor it falls into "OTHER" category - Set span status to ERROR on failures
Reference
Full guide with code examples: docs/INSTRUMENT_WITH_OTEL.md
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdocs/skills/instrument-otel/SKILL.md
Popularity
- Repository stars
- 35
- Repository forks
- 28
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/opensearch-project/agent-health/instrument-otel)