This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: prometheus-3-otlp-backpressure-governor

Prometheus 3.0 OTLP Exemplar Ingestion Governor & TSDB Backpressure Invariant

Enforces strict rate-limiting, exemplar truncation, and dynamic backpressure at the network boundary for Prometheus 3.0 native OTLP ingestion pipelines. Prevents catastrophic TSDB Write-Ahead Log (WAL) fragmentation, exemplar storage thrashing, and out-of-memory (OOM) heap exhaustion during uncoordinated telemetry microbursts. Mandates deterministic HTTP 429 status code emission with adaptive retry-after semantics before exemplar buffers breach bounded memory ceilings.

Prohibited Anti-Pattern: Unbounded OTLP Exemplar Forwarding and Head-of-Line TSDB WAL Saturation

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Prometheus 3.0 OTLP Exemplar Ingestion Governor & TSDB Backpressure Invariant - Enforces strict rate-limiting, exemplar truncation, and dynamic backpressure at the network boundary for Prometheus 3.0 native OTLP ingestion pipelines. Prevents catastrophic TSDB Write-Ahead Log (WAL) fragmentation, exemplar storage thrashing, and out-of-memory (OOM) heap exhaustion during uncoordinated telemetry microbursts. Mandates deterministic HTTP 429 status code emission with adaptive retry-after semantics before exemplar buffers breach bounded memory ceilings.
globs: config/**/*.{yaml,yml}, deployments/**/*.{yaml,yml}, src/telemetry/**/*.{go,ts,rs,py}, collector/**/*.{yaml,yml}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/prometheus-3-otlp-backpressure-governor"
---

# Prometheus 3.0 OTLP Exemplar Ingestion Governor & TSDB Backpressure Invariant

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Unbounded OTLP Exemplar Forwarding and Head-of-Line TSDB WAL Saturation

## System Constraints
You are a Principal DevOps and Observability Architect specializing in Prometheus 3.0 runtime internals and OpenTelemetry collector pipeline design. You must enforce zero-trust bounds around native OTLP ingestion endpoints. All collectors, forwarders, and ingestion gateways feeding Prometheus 3.0 TSDB must implement hard limits on exemplar cardinality, dynamic token-bucket throttling, and deterministic memory backpressure. Reject any configuration that permits unbounded memory allocation or allows raw, uncurated exemplar streams to flood the TSDB write path.

## Strict Guidelines
- Engineers MUST ALWAYS configure OpenTelemetry Collector pipelines to strip or sample exemplars via `transform` or `probabilistic_sampler` processors before forwarding to Prometheus 3.0 native endpoints (`/api/v1/otlp`).
- Services MUST emit an explicit HTTP `429 Too Many Requests` status with a `Retry-After` header when Prometheus ingestion queues cross the 80% memory saturation threshold, rather than silently dropping or buffering in heap.
- Engineers MUST NOT configure Prometheus 3.0 `--storage.tsdb.max-exemplars` without an explicit memory ceiling calculated against peak metric churn rates (maximum 100,000 exemplars per 16GB assigned TSDB heap).
- Collector forwarders MUST wrap the Prometheus OTLP exporter in a `batch` processor with explicit `send_batch_max_size` and bounded memory limits via the `memory_limiter` processor placed as the first pipeline element.
- Components NEVER accept incoming OTLP metric payloads containing high-cardinality exemplar trace IDs (e.g., raw UUIDs or unindexed baggage attributes) without verifying rate-limiter capacity tokens.

## Bad vs Good Implementations
### Collector-Side Exemplar Throttling and Memory Governor for Prometheus 3.0 OTLP Target

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Lacks memory_limiter safeguards and exemplar filtering. High-throughput distributed traces with unique trace/span IDs attached as metric exemplars will flood Prometheus 3.0's circular exemplar buffer, causing WAL contention, garbage collection thrashing, and node-level OOM crashes.
```yaml
# INSECURE: Passes raw OTLP payloads directly to Prometheus 3.0 with unbounded exemplars
receivers:
  otlp:
    protocols:
      grpc: { endpoint: 0.0.0.0:4317 }
      http: { endpoint: 0.0.0.0:4318 }

processors:
  batch:
    timeout: 1s
    send_batch_size: 8192

exporters:
  prometheusremotewrite:
    endpoint: http://prometheus:9090/api/v1/write
  otlphttp/prometheus:
    endpoint: http://prometheus:9090/api/v1/otlp

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

#### Production Standard (Correct)
> **Standard**: Implements an explicit memory limiter to apply immediate backpressure before queue overflow. Uses the OpenTelemetry Transformation Language (OTTL) to cap and normalize exemplar payloads to 1 per data point, and restricts exporter retries and queue sizes to prevent outbound queue memory blowouts.
```yaml
# HARDENED: Bounded memory, dynamic batch limits, and exemplar truncation at edge boundary
receivers:
  otlp:
    protocols:
      grpc: { endpoint: 0.0.0.0:4317 }
      http: { endpoint: 0.0.0.0:4318 }

processors:
  memory_limiter:
    check_interval: 250ms
    limit_percentage: 75
    spike_limit_percentage: 15

  transform/truncate_exemplars:
    error_mode: ignore
    metric_statements:
      - context: datapoint
        statements:
          # Drop exemplars when trace ID cardinality exceeds stability budgets or sample down
          - truncate_all_strings(exemplar.trace_id, 32)
          - limit(exemplar, 1)

  batch:
    send_batch_size: 4096
    send_batch_max_size: 8192
    timeout: 500ms

exporters:
  otlphttp/prometheus_bounded:
    endpoint: http://prometheus:9090/api/v1/otlp
    retry_on_failure:
      enabled: true
      initial_interval: 500ms
      max_interval: 5s
      max_elapsed_time: 30s
    sending_queue:
      enabled: true
      queue_size: 512
      storage: memory

service:
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [memory_limiter, transform/truncate_exemplars, batch]
      exporters: [otlphttp/prometheus_bounded]
```

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: Prometheus 3.0 OTLP Exemplar Ingestion Governor & TSDB Backpressure Invariant

Prometheus 3.0 OTLP Exemplar Ingestion Governor & TSDB Backpressure Invariant defines an industrial-grade behavioral standard for devops engineering. Enforces strict rate-limiting, exemplar truncation, and dynamic backpressure at the network boundary for Prometheus 3.0 native OTLP ingestion pipelines. Prevents catastrophic TSDB Write-Ahead Log (WAL) fragmentation, exemplar storage thrashing, and out-of-memory (OOM) heap exhaustion during uncoordinated telemetry microbursts. Mandates deterministic HTTP 429 status code emission with adaptive retry-after semantics before exemplar buffers breach bounded memory ceilings. 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: Unbounded OTLP Exemplar Forwarding and Head-of-Line TSDB WAL Saturation 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 DriftUnbounded OTLP Exemplar Forwarding and Head-of-Line TSDB WAL SaturationCritical
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 configure OpenTelemetry Collector pipelines to strip or sample exemplars via `transform` or `probabilistic_sampler` processors before forwarding to Prometheus 3.0 native endpoints (`/api/v1/otlp`).

Engineers MUST ALWAYS configure OpenTelemetry Collector pipelines to strip or sample exemplars via `transform` or `probabilistic_sampler` processors before forwarding to Prometheus 3.0 native endpoints (`/api/v1/otlp`).

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

Services MUST emit an explicit HTTP `429 Too Many Requests` status with a `Retry-After` header when Prometheus ingestion queues cross the 80% memory saturation threshold, rather than silently dropping or buffering in heap.

Services MUST emit an explicit HTTP `429 Too Many Requests` status with a `Retry-After` header when Prometheus ingestion queues cross the 80% memory saturation threshold, rather than silently dropping or buffering in heap.

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

Engineers MUST NOT configure Prometheus 3.0 `--storage.tsdb.max-exemplars` without an explicit memory ceiling calculated against peak metric churn rates (maximum 100,000 exemplars per 16GB assigned TSDB heap).

Engineers MUST NOT configure Prometheus 3.0 `--storage.tsdb.max-exemplars` without an explicit memory ceiling calculated against peak metric churn rates (maximum 100,000 exemplars per 16GB assigned TSDB heap).

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

Collector forwarders MUST wrap the Prometheus OTLP exporter in a `batch` processor with explicit `send_batch_max_size` and bounded memory limits via the `memory_limiter` processor placed as the first pipeline element.

Collector forwarders MUST wrap the Prometheus OTLP exporter in a `batch` processor with explicit `send_batch_max_size` and bounded memory limits via the `memory_limiter` processor placed as the first pipeline element.

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

Components NEVER accept incoming OTLP metric payloads containing high-cardinality exemplar trace IDs (e.g., raw UUIDs or unindexed baggage attributes) without verifying rate-limiter capacity tokens.

Components NEVER accept incoming OTLP metric payloads containing high-cardinality exemplar trace IDs (e.g., raw UUIDs or unindexed baggage attributes) without verifying rate-limiter capacity tokens.

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 Prometheus 3.0 OTLP Exemplar Ingestion Governor & TSDB Backpressure Invariant critical for AI coding assistants?

Enforces strict rate-limiting, exemplar truncation, and dynamic backpressure at the network boundary for Prometheus 3.0 native OTLP ingestion pipelines. Prevents catastrophic TSDB Write-Ahead Log (WAL) fragmentation, exemplar storage thrashing, and out-of-memory (OOM) heap exhaustion during uncoordinated telemetry microbursts. Mandates deterministic HTTP 429 status code emission with adaptive retry-after semantics before exemplar buffers breach bounded memory ceilings. 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 (Unbounded OTLP Exemplar Forwarding and Head-of-Line TSDB WAL Saturation) 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

Prometheus