→ Back to Home
OpenTelemetry

OpenTelemetry eBPF: Unused Prometheus Exporter Causes Memory Bloat in Production

A recent analysis highlighted a significant memory consumption issue within OpenTelemetry eBPF Instrumentation (OBI) when its Prometheus exporter is enabled but not actively scraped. The problem stems from the default OBI Helm chart configuration, which activates the `prometheus_export` endpoint on port 9090 without automatically creating the necessary Kubernetes Service or ServiceMonitor to facilitate scraping. Consequently, OBI continues to discover services and update labeled Prometheus metric children, but without an active scraper, the mechanism for expiring inactive metric series is not triggered. This leads to the accumulation of stale metric data in memory, causing the OBI process to grow unboundedly. The article clarifies that OBI's documented Time-To-Live (TTL) for metrics is only applied during a scrape operation, meaning an un-scraped endpoint will retain data indefinitely. This finding is critical for any organization deploying OpenTelemetry eBPF Instrumentation, particularly those relying on Prometheus for metrics collection. Uncontrolled memory growth in observability agents can lead to severe operational issues, including OOM (Out Of Memory) errors, application instability, and increased infrastructure costs. DevOps teams, SREs, and platform engineers are directly affected, as they are responsible for maintaining the health and efficiency of monitoring systems. The issue underscores a subtle but impactful configuration pitfall that can undermine the reliability benefits that OBI aims to provide. It highlights the importance of meticulous configuration management, especially with default settings that might not align with all deployment scenarios. This incident fits squarely within the broader trend of increasing complexity in cloud-native observability and the growing adoption of eBPF for deep system insights. OpenTelemetry has become the de facto standard for instrumenting applications, and eBPF offers unparalleled low-overhead data collection from the kernel, making OBI a powerful tool for comprehensive observability. However, as these sophisticated tools become more prevalent, the operational burden of correctly configuring and managing them also rises. This specific memory leak issue is a prime example of how the interplay between different components—like an eBPF agent, its Prometheus exporter, and Kubernetes service discovery—can introduce unexpected challenges. The cloud-native ecosystem continually strives for "observability as code" and automated deployments, but such incidents remind practitioners that defaults and implicit behaviors must be thoroughly understood and validated. The ongoing evolution of OpenTelemetry and its various components, including the Collector and SDKs, frequently introduces new features and optimizations, but also necessitates vigilance regarding their operational implications. Practitioners deploying OBI should immediately review their Helm chart configurations. The primary recommendation is to explicitly disable the Prometheus exporter if metrics are being sent via OTLP (OpenTelemetry Protocol) only, or to ensure that a Prometheus instance is actively and correctly scraping the OBI endpoint if the exporter is enabled. This involves verifying the Kubernetes Service and ServiceMonitor configurations, ensuring selectors match, and confirming that Prometheus is indeed discovering and scraping the OBI target. The article suggests three deliberate deployment modes: OTLP-only metrics, chart-managed Prometheus scraping, or direct pod discovery. Choosing one explicitly and configuring it correctly is paramount. Furthermore, practitioners should not rely on the metric TTL to bound memory if scraping is not occurring, as the cleanup is scrape-driven. This situation also highlights the value of robust monitoring for the observability stack itself, including tracking the memory usage of OBI pods, to detect such issues proactively.
#opentelemetry#ebpf#prometheus#memory leak#observability#metrics
Read original source