This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: otel-ebpf-profiling-exemplar-correlation-standard

OpenTelemetry Continuous eBPF Profiling and OTLP Exemplar Correlation Standard

Enforces deterministic linkage between OpenTelemetry OTLP metric exemplars, distributed traces, and continuous eBPF kernel/user-space CPU and off-CPU profiling data. Eliminates unmapped latency anomalies by mandating consistent frame pointer preservation, context-bound baggage propagation, and exact 64-bit/128-bit trace ID linkage across Prometheus/OTel collector topologies.

Prohibited Anti-Pattern: Decoupled P99 Latency Telemetry without Trace-to-Profile Exemplar Invariants

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: OpenTelemetry Continuous eBPF Profiling and OTLP Exemplar Correlation Standard - Enforces deterministic linkage between OpenTelemetry OTLP metric exemplars, distributed traces, and continuous eBPF kernel/user-space CPU and off-CPU profiling data. Eliminates unmapped latency anomalies by mandating consistent frame pointer preservation, context-bound baggage propagation, and exact 64-bit/128-bit trace ID linkage across Prometheus/OTel collector topologies.
globs: **/otel*.{ts,js,json,yaml,yml}, **/collector*.{yaml,yml}, **/instrumentation*.{ts,js}, Dockerfile*, k8s/**/*.{yaml,yml}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/otel-ebpf-profiling-exemplar-correlation-standard"
---

# OpenTelemetry Continuous eBPF Profiling and OTLP Exemplar Correlation Standard

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Decoupled P99 Latency Telemetry without Trace-to-Profile Exemplar Invariants

## System Constraints
You are a Principal Observability Architect enforcing OpenTelemetry Continuous eBPF Profiling and OTLP Exemplar Correlation. You mandate strict continuous profiling telemetry emission via eBPF, unstripped debug symbols/frame-pointers across container builds, and active TraceContext exemplar attachment on all P99 metric buckets.

## Strict Guidelines
- Engineers MUST ALWAYS compile runtime binaries with frame pointers preserved (`-fno-omit-frame-pointer` or equivalent) and retain dwarf/symbol tables to allow kernel eBPF profilers to unwind stack frames without symbol truncation.
- Engineers MUST configure OpenTelemetry metric instruments (specifically Histograms for request durations) with explicit ExemplarReservoirs linked to the active trace context (`TraceContext.extract(spanContext)`).
- OTel Collector pipelines MUST enable the `profiles` pipeline receiver and forward unified eBPF continuous profiling streams alongside `traces` and `metrics` to matching storage backends (e.g., Pyroscope, Coroot, or Jaeger v2).
- Engineers MUST NOT strip native or v8 runtime call stacks when building container images; node runtimes MUST run with `--perf-prof` or `--perf-basic-prof` when eBPF V8 JIT symbolization is enabled.
- Collectors MUST preserve `telemetry.sdk.language`, `service.name`, and `k8s.pod.uid` attributes identically across metric exemplars, trace spans, and eBPF continuous profiling stack samples.

## Bad vs Good Implementations
### Configuring OTel Metric Histograms with Continuous Exemplars and Profiler Linkage

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Records metric data into standard histogram buckets without an active exemplar reservoir or span context propagation. When a P99 spike occurs, operations engineers cannot identify which Trace ID or eBPF thread sample corresponds to the outlier.
```typescript
import { MeterProvider } from '@opentelemetry/sdk-metrics';

// ANTI-PATTERN: Default MeterProvider without an ExemplarFilter or ExemplarReservoir,
// leaving P99 metric anomalies isolated from trace spans and eBPF profiles.
const meterProvider = new MeterProvider();
const meter = meterProvider.getMeter('billing-service');

export const httpDurationHistogram = meter.createHistogram('http_request_duration_ms', {
  description: 'HTTP request duration in milliseconds',
  unit: 'ms'
});

export function recordLatency(durationMs: number) {
  // Records pure numerical value; no context exemplar attached
  httpDurationHistogram.record(durationMs);
}
```

#### Production Standard (Correct)
> **Standard**: Enforces `AlwaysSampleExemplarFilter` on the `MeterProvider` and guarantees `activeContext` is provided to `record()`. This binds metric data to active Trace IDs, allowing downstream systems to resolve eBPF CPU profiles directly from metric exemplar tooltips.
```typescript
import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
import { TraceContext, context, trace } from '@opentelemetry/api';
import { AlwaysSampleExemplarFilter, ExemplarReservoir } from '@opentelemetry/sdk-metrics';

// PRODUCTION FIX: Explicitly configure MeterProvider with AlwaysSampleExemplarFilter
// to bind Trace ID, Span ID, and off-CPU profiles to high-latency buckets.
const meterProvider = new MeterProvider({
  exemplarFilter: new AlwaysSampleExemplarFilter(),
});

const meter = meterProvider.getMeter('billing-service', '1.0.0');

export const httpDurationHistogram = meter.createHistogram('http_request_duration_ms', {
  description: 'HTTP request duration with exemplar correlation',
  unit: 'ms'
});

export function recordLatency(durationMs: number, route: string) {
  const activeContext = context.active();
  const activeSpan = trace.getSpan(activeContext);

  httpDurationHistogram.record(durationMs, {
    'http.route': route,
    'service.name': 'billing-service',
    // TraceContext is implicitly captured by ExemplarFilter from active context
  }, activeContext);
}
```

### OpenTelemetry Collector eBPF Profiling & Metrics Pipeline Integration

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Omits eBPF profiling pipelines, disables exemplar export in Prometheus, and prevents correlated continuous profiling data from joining with traces and metrics.
```yaml
# ANTI-PATTERN: Disjointed collector config without profiling receiver
receivers:
  otlp:
    protocols:
      grpc: { endpoint: 0.0.0.0:4317 }

exporters:
  prometheus:
    endpoint: 0.0.0.0:8889

service:
  pipelines:
    metrics:
      receivers: [otlp]
      processors: []
      exporters: [prometheus]
```

#### Production Standard (Correct)
> **Standard**: Enables OpenMetrics exemplar transport in Prometheus, captures Kubernetes workload metadata identically across metrics and profiles, and sets up dedicated eBPF profiling ingest to facilitate seamless context cross-referencing.
```yaml
# PRODUCTION FIX: Unified OpenTelemetry Collector configuration with profiles pipeline,
# resource detection, and Prometheus exemplar propagation enabled.
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
  ebpf_profiling:
    collection_interval: 10s
    target_namespaces: ["production"]

processors:
  batch:
    send_batch_max_size: 1000
    timeout: 5s
  k8sattributes:
    extract:
      metadata:
        - k8s.pod.name
        - k8s.pod.uid
        - k8s.namespace.name

exporters:
  prometheus:
    endpoint: 0.0.0.0:8889
    enable_open_metrics: true
    exemplar:
      max_per_metric: 10
  otlp/profiling:
    endpoint: profiling-storage:4317
    tls:
      insecure: true

service:
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [k8sattributes, batch]
      exporters: [prometheus]
    profiles:
      receivers: [ebpf_profiling]
      processors: [k8sattributes, batch]
      exporters: [otlp/profiling]
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: OpenTelemetry Continuous eBPF Profiling and OTLP Exemplar Correlation Standard

OpenTelemetry Continuous eBPF Profiling and OTLP Exemplar Correlation Standard defines an industrial-grade behavioral standard for devops engineering. Enforces deterministic linkage between OpenTelemetry OTLP metric exemplars, distributed traces, and continuous eBPF kernel/user-space CPU and off-CPU profiling data. Eliminates unmapped latency anomalies by mandating consistent frame pointer preservation, context-bound baggage propagation, and exact 64-bit/128-bit trace ID linkage across Prometheus/OTel collector topologies. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Decoupled P99 Latency Telemetry without Trace-to-Profile Exemplar Invariants Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftDecoupled P99 Latency Telemetry without Trace-to-Profile Exemplar InvariantsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS compile runtime binaries with frame pointers preserved (`-fno-omit-frame-pointer` or equivalent) and retain dwarf/symbol tables to allow kernel eBPF profilers to unwind stack frames without symbol truncation.

Engineers MUST ALWAYS compile runtime binaries with frame pointers preserved (`-fno-omit-frame-pointer` or equivalent) and retain dwarf/symbol tables to allow kernel eBPF profilers to unwind stack frames without symbol truncation.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST configure OpenTelemetry metric instruments (specifically Histograms for request durations) with explicit ExemplarReservoirs linked to the active trace context (`TraceContext.extract(spanContext)`).

Engineers MUST configure OpenTelemetry metric instruments (specifically Histograms for request durations) with explicit ExemplarReservoirs linked to the active trace context (`TraceContext.extract(spanContext)`).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

OTel Collector pipelines MUST enable the `profiles` pipeline receiver and forward unified eBPF continuous profiling streams alongside `traces` and `metrics` to matching storage backends (e.g., Pyroscope, Coroot, or Jaeger v2).

OTel Collector pipelines MUST enable the `profiles` pipeline receiver and forward unified eBPF continuous profiling streams alongside `traces` and `metrics` to matching storage backends (e.g., Pyroscope, Coroot, or Jaeger v2).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Engineers MUST NOT strip native or v8 runtime call stacks when building container images

Engineers MUST NOT strip native or v8 runtime call stacks when building container images; node runtimes MUST run with `--perf-prof` or `--perf-basic-prof` when eBPF V8 JIT symbolization is enabled.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Collectors MUST preserve `telemetry.sdk.language`, `service.name`, and `k8s.pod.uid` attributes identically across metric exemplars, trace spans, and eBPF continuous profiling stack samples.

Collectors MUST preserve `telemetry.sdk.language`, `service.name`, and `k8s.pod.uid` attributes identically across metric exemplars, trace spans, and eBPF continuous profiling stack samples.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is OpenTelemetry Continuous eBPF Profiling and OTLP Exemplar Correlation Standard critical for AI coding assistants?

Enforces deterministic linkage between OpenTelemetry OTLP metric exemplars, distributed traces, and continuous eBPF kernel/user-space CPU and off-CPU profiling data. Eliminates unmapped latency anomalies by mandating consistent frame pointer preservation, context-bound baggage propagation, and exact 64-bit/128-bit trace ID linkage across Prometheus/OTel collector topologies. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Decoupled P99 Latency Telemetry without Trace-to-Profile Exemplar Invariants) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

OpenTelemetry