Exposing the metrics
The OpenTelemetry Collector exposes metrics about the volume of data it has processed. These metrics are valuable for monitoring the Collector's operational status and diagnosing data collection issues.
TOC
Available metricsConfiguring metrics exposureConfiguring the Prometheus metrics endpointEnabling metrics scrapingManual verification (optional)Accessing the metricsAvailable metrics
The Collector exposes the following metrics related to data processing volume:
Spans metrics
otelcol_receiver_accepted_spans: Number of spans accepted by receiversotelcol_receiver_refused_spans: Number of spans refused by receiversotelcol_exporter_sent_spans: Number of spans sent by exportersotelcol_exporter_enqueue_failed_spans: Number of spans that failed to enqueue in exporters
Logs metrics
otelcol_receiver_accepted_logs: Number of log records accepted by receiversotelcol_receiver_refused_logs: Number of log records refused by receiversotelcol_exporter_sent_logs: Number of log records sent by exportersotelcol_exporter_enqueue_failed_logs: Number of log records that failed to enqueue in exporters
Metrics metrics
otelcol_receiver_accepted_metrics: Number of metric data points accepted by receiversotelcol_receiver_refused_metrics: Number of metric data points refused by receiversotelcol_exporter_sent_metrics: Number of metric data points sent by exportersotelcol_exporter_enqueue_failed_metrics: Number of metric data points that failed to enqueue in exporters
Configuring metrics exposure
Configuring the Prometheus metrics endpoint
To expose the Collector's internal metrics, configure a Prometheus pull exporter in the OpenTelemetryCollector custom resource (CR). The following example configures the Collector to expose metrics in Prometheus format on port 8888:
Enabling metrics scraping
To enable Prometheus to automatically scrape the Collector metrics, set the spec.observability.metrics.enableMetrics field to true in the OpenTelemetryCollector CR. The Operator automatically creates a ServiceMonitor or PodMonitor resource based on the Collector's deployment mode:
Manual verification (optional)
You can verify the metrics endpoint directly by using kubectl port-forward to access the Collector's metrics port:
Then, open http://localhost:8888/metrics in your browser or use curl to verify that the metrics are exposed:
Accessing the metrics
After enabling metrics scraping, you can verify and access the Collector metrics through the Prometheus web console in Alauda Container Platform:
-
Access the Prometheus web console in your Alauda Container Platform cluster.
-
Navigate to Status → Targets.
-
Verify that the
ServiceMonitorsorPodMonitorsin the<instance_name>-collectorformat have the Up status.
Once the targets are confirmed as Up, you can use the Prometheus query interface to explore the Collector metrics listed in the Available metrics section.