This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: otel-arrow-batch-compaction-memory-watermark

Deterministic Arrow Batch Compaction and High-Watermark Memory Shedding

Enforces strict memory-limiter-driven watermarks and deterministic columnar batch compaction bounds for OpenTelemetry OTLP-Arrow pipelines. Prevents catastrophic OOM panic loops caused by unbounded record construction, non-contiguous Apache Arrow buffer allocation, and unthrottled upstream streaming during downstream backpressure.

Prohibited Anti-Pattern: Unbounded Columnar Buffer Allocations with Decoupled Pipeline Memory Limits Inducing OOM Panics

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Deterministic Arrow Batch Compaction and High-Watermark Memory Shedding - Enforces strict memory-limiter-driven watermarks and deterministic columnar batch compaction bounds for OpenTelemetry OTLP-Arrow pipelines. Prevents catastrophic OOM panic loops caused by unbounded record construction, non-contiguous Apache Arrow buffer allocation, and unthrottled upstream streaming during downstream backpressure.
globs: **/collector/*.yaml, **/otelcol/*.yaml, **/otel-collector*.yaml, **/pipelines/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/otel-arrow-batch-compaction-memory-watermark"
---

# Deterministic Arrow Batch Compaction and High-Watermark Memory Shedding

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Unbounded Columnar Buffer Allocations with Decoupled Pipeline Memory Limits Inducing OOM Panics

## System Constraints
You are a Principal Infrastructure & Observability Architect enforcing strict memory guarantees on OpenTelemetry Collector instances utilizing OTLP-Arrow. Mandate deterministic memory-limiter configurations preceding arrow batch processors, explicit high/low compaction watermarks, non-zero allocation step ceilings, and immediate upstream backpressure propagation over unbounded buffering.

## Strict Guidelines
- Processors MUST ALWAYS order `memory_limiter` before `batch` or `arrow` compaction processors in the collector pipeline sequence.
- Engineers MUST configure `check_interval` to at least 1s and set `limit_percentage` or `limit_mib` strictly below the hard container cgroup threshold (maximum 80% of cgroup RAM).
- Arrow batching components MUST explicitly define `max_bytes`, `max_allocated_rows`, and compaction timeout intervals to prevent sparse multi-megabyte record batch pinning in the Go runtime heap.
- Engineers MUST NOT disable upstream backpressure signals or rely on infinite channel queueing (`queue_size: 0` or unbounded `sending_queue`) when compaction buffers are saturated.
- Pipelines MUST configure proactive dynamic chunk shedding or explicit client-side rejection (HTTP/gRPC retry-after codes) at the high watermark rather than relying on kernel OOM killer mechanisms.

## Bad vs Good Implementations
### OTel Collector Pipeline: Memory-Limiter and Arrow Compaction Configuration

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Omits the `memory_limiter` processor ahead of the compaction stage and allows unbounded batch payload accumulation. Under downstream backpressure, Arrow schema compilation and record building allocate rapid non-contiguous memory, triggering kernel cgroup OOM kills.
```yaml
processors:
  batch:
    # FLUID/UNBOUNDED: Compacting unbounded payloads without pre-flight memory check
    send_batch_size: 100000
    timeout: 30s

service:
  pipelines:
    traces:
      receivers: [otlp]
      # ANTI-PATTERN: Batching occurs without upstream memory limit guards;
      # under downstream backpressure, Apache Arrow columnar structures allocate
      # multi-gigabyte off-heap/heap records, inducing process SIGKILL.
      processors: [batch]
      exporters: [otlp/arrow]
```

#### Production Standard (Correct)
> **Standard**: Guarantees that `memory_limiter` evaluates heap growth every second and applies early backpressure shedding if consumption reaches 75% cgroup memory with a 15% spike barrier. Bounded batch sizes ensure deterministic Arrow columnar projection memory envelopes.
```yaml
processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 75
    spike_limit_percentage: 15
  batch:
    send_batch_size: 8192
    timeout: 200ms
    send_batch_max_size: 16384

exporters:
  otlp/arrow:
    endpoint: downstream.telemetry.svc:4317
    arrow:
      num_streams: 4
      max_stream_lifetime: 5m
    sending_queue:
      enabled: true
      num_consumers: 8
      queue_size: 256
    retry_on_failure:
      enabled: true
      initial_interval: 1s
      max_interval: 10s

service:
  pipelines:
    traces:
      receivers: [otlp]
      # INVARIANT: memory_limiter executed first to shed/reject loads at high-watermark,
      # followed by bounded batching prior to columnar encoding.
      processors: [memory_limiter, batch]
      exporters: [otlp/arrow]
```

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: Deterministic Arrow Batch Compaction and High-Watermark Memory Shedding

Deterministic Arrow Batch Compaction and High-Watermark Memory Shedding defines an industrial-grade behavioral standard for devops engineering. Enforces strict memory-limiter-driven watermarks and deterministic columnar batch compaction bounds for OpenTelemetry OTLP-Arrow pipelines. Prevents catastrophic OOM panic loops caused by unbounded record construction, non-contiguous Apache Arrow buffer allocation, and unthrottled upstream streaming during downstream backpressure. 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 Columnar Buffer Allocations with Decoupled Pipeline Memory Limits Inducing OOM Panics 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 Columnar Buffer Allocations with Decoupled Pipeline Memory Limits Inducing OOM PanicsCritical
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

Processors MUST ALWAYS order `memory_limiter` before `batch` or `arrow` compaction processors in the collector pipeline sequence.

Processors MUST ALWAYS order `memory_limiter` before `batch` or `arrow` compaction processors in the collector pipeline sequence.

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 `check_interval` to at least 1s and set `limit_percentage` or `limit_mib` strictly below the hard container cgroup threshold (maximum 80% of cgroup RAM).

Engineers MUST configure `check_interval` to at least 1s and set `limit_percentage` or `limit_mib` strictly below the hard container cgroup threshold (maximum 80% of cgroup RAM).

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

Arrow batching components MUST explicitly define `max_bytes`, `max_allocated_rows`, and compaction timeout intervals to prevent sparse multi-megabyte record batch pinning in the Go runtime heap.

Arrow batching components MUST explicitly define `max_bytes`, `max_allocated_rows`, and compaction timeout intervals to prevent sparse multi-megabyte record batch pinning in the Go runtime 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

Engineers MUST NOT disable upstream backpressure signals or rely on infinite channel queueing (`queue_size

Engineers MUST NOT disable upstream backpressure signals or rely on infinite channel queueing (`queue_size: 0` or unbounded `sending_queue`) when compaction buffers are saturated.

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

Pipelines MUST configure proactive dynamic chunk shedding or explicit client-side rejection (HTTP/gRPC retry-after codes) at the high watermark rather than relying on kernel OOM killer mechanisms.

Pipelines MUST configure proactive dynamic chunk shedding or explicit client-side rejection (HTTP/gRPC retry-after codes) at the high watermark rather than relying on kernel OOM killer mechanisms.

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 Deterministic Arrow Batch Compaction and High-Watermark Memory Shedding critical for AI coding assistants?

Enforces strict memory-limiter-driven watermarks and deterministic columnar batch compaction bounds for OpenTelemetry OTLP-Arrow pipelines. Prevents catastrophic OOM panic loops caused by unbounded record construction, non-contiguous Apache Arrow buffer allocation, and unthrottled upstream streaming during downstream backpressure. 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 Columnar Buffer Allocations with Decoupled Pipeline Memory Limits Inducing OOM Panics) 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

Deterministic