OpenTelemetry MCP Server Examples & Scenarios
These real-world operational scenarios demonstrate how AI assistants (Claude, Cursor, Cline, or TalkOps autonomous controllers) use the OpenTelemetry MCP Server to solve complex observability tasks on Kubernetes.
Scenario 1: Intent-Driven Namespace Telemetry Provisioning
User Prompt:
"I need to collect traces and metrics in the
paymentsnamespace and export them to Tempo and Mimir inmonitoring. Set up an OpenTelemetry collector with best practices."
What Happens:
- The AI calls
otel_provision_collectorwithnamespace="payments",signals=["traces", "metrics"], andenable_spanmetrics=true. - The MCP server queries the Kubernetes cluster, auto-discovers active backend services (
tempo.monitoring.svc:4317andmimir.monitoring.svc:9009), and generates a production-grade collector configuration. - The server ensures strict processor sequencing (
memory_limiter → k8sattributes → resourcedetection → batch). - The server creates the required
ClusterRoleandClusterRoleBindingfork8sattributespod metadata enrichment. - The AI presents the complete manifest diff to the engineer before applying the changes.
Result:
A fully functional OpenTelemetryCollector is deployed to the payments namespace, with resource limits properly sized and telemetry streaming securely to your backends.
Scenario 2: Zero-Touch Polyglot Auto-Instrumentation
User Prompt:
"Onboard the
order-servicePython FastAPI app inproductionto OpenTelemetry with 15% trace sampling."
What Happens:
- The AI calls
otel_lookup_instrumentation(language="python", framework="fastapi")to verify SDK compatibility and obtain the standard injection annotation (instrumentation.opentelemetry.io/inject-python). - It calls
otel_patch_instrumentationto ensure anInstrumentationCRD exists inproductionconfigured withsampler_type="parentbased_traceidratio"andsampler_argument="0.15". - The AI executes
otel_annotate_deployment(deployment_name="order-service", namespace="production", language="python"). - The tool scans existing container environment variables to verify that no hardcoded
OTEL_EXPORTER_OTLP_ENDPOINTconflicts exist that would override the Operator's configuration. - The deployment pod template is annotated, triggering a smooth rolling restart with the OTel Python init container injected.
Result:
All inbound HTTP requests and outbound database calls from order-service are automatically traced and exported without touching application source code.
Scenario 3: Investigating High-Cardinality SpanMetrics
User Prompt:
"Prometheus memory usage is spiking after enabling SpanMetrics on
otel-gateway. Audit the dimensions and fix any high-cardinality attributes."
What Happens:
- The AI calls
otel_detect_cardinality(collector_name="otel-gateway", namespace="monitoring"). - The audit reveals that
http.url(containing raw UUID path parameters) anduser.idare active dimensions, generating over 45,000 distinct time series. - The AI calls
otel_gen_drop_attribute_rules(signal="metrics", attributes_to_drop=["http.url", "user.id"])to generate an OTTL remediation snippet:
processors:
transform/strip_high_cardinality:
metric_statements:
- context: datapoint
statements:
- delete_key(attributes, "http.url")
- delete_key(attributes, "user.id")
- The AI presents the proposed collector patch to the operator and applies it via
otel_patch_collector(dry_run=false).
Result: Active time-series counts drop by 92%, stabilizing Prometheus memory without losing latency distribution insights.
Scenario 4: Aligning Multi-Tier Sampling Policies
User Prompt:
"We're missing critical error traces in Tempo. Check our sampling configuration to see why 500 errors are getting dropped."
What Happens:
- The AI calls
otel_inspect_sampling_configuration(collector_name="otel-traces", namespace="monitoring"). - The tool flags a major architectural conflict: the SDK
InstrumentationCRD has a 5% probabilistic head sampler (traceidratio: 0.05), while the collector has a 100% error tail-sampling policy. Because the head sampler drops 95% of all spans before they ever reach the collector, the tail sampler never gets a chance to evaluate the failed requests. - The AI calls
otel_toggle_sampling_strategyto apply a hybrid strategy: switching SDK head sampling toalways_onand delegating sampling decisions entirely to the collector's tail-sampling processor.
Result: 100% of error traces and slow requests (> 1.5s) are preserved in Tempo, while healthy background requests are sampled at a cost-effective 10% rate.