Skip to content

Claude Code

The Claude Code Observability Plugin teaches Claude how to query and investigate traces, logs, and metrics from your OpenSearch-based observability stack. It provides eight skill files containing PPL query templates for OpenSearch, PromQL query templates for Prometheus, and ready-to-execute curl commands.

The plugin follows the open Agent Skills specification, so the same skill files work across Claude Code (CLI), Claude for VS Code, and Claude Desktop.

SkillWhat it does
TracesPPL queries for agent invocations, tool executions, slow spans, error spans, token usage, service maps, remote service identification
LogsPPL queries for severity filtering, trace correlation, error patterns, log volume, full-text search
MetricsPromQL queries for HTTP rates, latency percentiles, error rates, GenAI metrics
Stack HealthHealth checks, troubleshooting, port reference, diagnostic commands
PPL Reference50+ PPL commands with syntax, examples, and function reference
CorrelationCross-signal workflows linking traces, logs, and metrics with batch correlation and coalesce() patterns
APM REDRate/Errors/Duration methodology queries with safe division, topk(), and availability patterns
SLO/SLISLI definitions, recording rules, error budgets, burn rate alerts
  • A running Observability Stack (or any OpenSearch + Prometheus setup)
  • One of: Claude Code CLI, Claude for VS Code, or Claude Desktop

First, add the repository as a plugin marketplace:

/plugin marketplace add https://github.com/opensearch-project/observability-stack.git

Then install the plugin:

/plugin install observability@observability

All eight skills are registered and Claude automatically routes to the right one based on your question.

Verify the skills loaded:

/skills

Claude Desktop supports custom skills through Settings → Capabilities → Skills. Each skill must be uploaded as a separate ZIP file.

Pre-built ZIP files are attached to each GitHub release - one per skill:

ZIP fileSkill
traces.zipTrace querying and investigation
logs.zipLog searching and correlation
metrics.zipPromQL metrics queries
stack-health.zipHealth checks and troubleshooting
ppl-reference.zipPPL syntax reference
correlation.zipCross-signal correlation
apm-red.zipRED methodology metrics
slo-sli.zipSLO/SLI definitions and alerts

To install:

  1. Download or clone the repository:

    Terminal window
    git clone https://github.com/opensearch-project/observability-stack.git
  2. In Claude Desktop, go to Settings → Capabilities → Skills

  3. Click Add and upload each ZIP file from claude-code-observability-plugin/dist/

  4. Enable each skill after uploading

Once installed, start asking questions:

Show me the slowest traces from the last hour
What's the error rate across services?
Check if the observability stack is healthy
Calculate the error budget for a 99.9% availability SLO

See the Usage Guide for 50+ sample questions across all eight skills.

The plugin defaults to the local Observability Stack:

ServiceEndpointAuth
OpenSearchhttps://localhost:9200Basic auth (admin / My_password_123!@#), skip TLS verify
Prometheushttp://localhost:9090None

Set environment variables to override defaults:

Terminal window
export OPENSEARCH_ENDPOINT=https://your-opensearch-host:9200
export PROMETHEUS_ENDPOINT=http://your-prometheus-host:9090

The skill files include AWS SigV4 variants for Amazon OpenSearch Service and Amazon Managed Service for Prometheus. When using managed services, the query syntax stays the same - only the endpoint URL and authentication method change.

The plugin queries these OpenSearch indices:

SignalIndex PatternKey Fields
Tracesotel-v1-apm-span-*traceId, spanId, serviceName, name, durationInNanos, status.code, attributes.gen_ai.*
Logslogs-otel-v1-*traceId, spanId, severityText, body, resource.attributes.service.name, @timestamp
Service Mapsotel-v2-apm-service-map-*sourceNode, targetNode, sourceOperation, targetOperation

The plugin includes a test suite to validate skill file correctness:

Terminal window
cd claude-code-observability-plugin/tests
pip install -r requirements.txt
# Property tests (no running stack needed)
pytest test_properties.py -v
# Integration tests (requires running stack)
pytest -v

Tests and skills require OpenSearch and Prometheus to be running locally:

Terminal window
docker compose up -d opensearch prometheus

Check the password in .env matches the default: My_password_123!@#

The stack includes example services that generate telemetry automatically. Verify they’re running:

Terminal window
docker compose ps | grep -E "canary|weather|travel"

Clear the corrupted WAL data:

Terminal window
docker compose stop prometheus
docker compose rm -f prometheus
docker volume rm observability-stack_prometheus-data
docker compose up -d prometheus