Architectural Invariant Design: OpenTelemetry Collector Cgroup v2 Memory Limiter and GOMEMLIMIT Hard-Cap Standard
OpenTelemetry Collector Cgroup v2 Memory Limiter and GOMEMLIMIT Hard-Cap Standard defines an industrial-grade behavioral standard for devops engineering. Enforces strict mathematical alignment between Kubernetes Cgroup v2 container memory limits, the Go runtime GOMEMLIMIT parameter, and the OpenTelemetry Collector memory_limiter processor. Guarantees that telemetric shedding and garbage collection invoke before kernel memory.high or memory.max thresholds trigger an ungraceful OOMKilled (SIGKILL 137) container eviction. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.
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 Mode | AI Symptom (The Anti-Pattern) | Severity | Production Impact & Remedy |
|---|---|---|---|
| AI Hallucination & Deprecation Drift | Misaligned or Absent memory_limiter Processor Causing Silent Container Eviction During Ingestion Bursts | Critical | 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 Inconsistency | AI 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. |
Step-by-Step Production Directives
Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:
Engineers MUST ALWAYS declare the 'memory_limiter' processor as the FIRST processor in every active telemetry pipeline (traces, metrics, logs).
Engineers MUST ALWAYS declare the 'memory_limiter' processor as the FIRST processor in every active telemetry pipeline (traces, metrics, logs).
Engineers MUST NEVER use the deprecated 'memory_ballast' extension
Engineers MUST NEVER use the deprecated 'memory_ballast' extension; all heap sizing must be governed via Go runtime 'GOMEMLIMIT' and Cgroup v2.
Services MUST define identical resource 'limits.memory' and 'requests.memory' to ensure a Guaranteed Quality of Service (QoS) class in Kubernetes.
Services MUST define identical resource 'limits.memory' and 'requests.memory' to ensure a Guaranteed Quality of Service (QoS) class in Kubernetes.
The 'GOMEMLIMIT' environment variable MUST be explicitly set to 80% of the container's hard memory limit (e.g., 1600MiB for a 2000MiB container limit).
The 'GOMEMLIMIT' environment variable MUST be explicitly set to 80% of the container's hard memory limit (e.g., 1600MiB for a 2000MiB container limit).
The 'memory_limiter' configuration MUST set 'check_interval' to 1s or less, 'limit_percentage' to at most 75%, and 'spike_limit_percentage' to at most 20%.
The 'memory_limiter' configuration MUST set 'check_interval' to 1s or less, 'limit_percentage' to at most 75%, and 'spike_limit_percentage' to at most 20%.
Engineers MUST NOT configure absolute 'limit_mib' values without automated synchronization scripts, favoring 'limit_percentage' and 'spike_limit_percentage' to dynamically respect the Cgroup hierarchy.
Engineers MUST NOT configure absolute 'limit_mib' values without automated synchronization scripts, favoring 'limit_percentage' and 'spike_limit_percentage' to dynamically respect the Cgroup hierarchy.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is OpenTelemetry Collector Cgroup v2 Memory Limiter and GOMEMLIMIT Hard-Cap Standard critical for AI coding assistants?
Enforces strict mathematical alignment between Kubernetes Cgroup v2 container memory limits, the Go runtime GOMEMLIMIT parameter, and the OpenTelemetry Collector memory_limiter processor. Guarantees that telemetric shedding and garbage collection invoke before kernel memory.high or memory.max thresholds trigger an ungraceful OOMKilled (SIGKILL 137) container eviction. 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 (Misaligned or Absent memory_limiter Processor Causing Silent Container Eviction During Ingestion Bursts) 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.