opentelemetry-collector
opentelemetry-collector copied to clipboard
Open Telemetry internal metrics of type "counter" emitted via prometheus exporter not comply prometheus metrics naming convention
Component(s)
exporter/exporterhelper, exporter/otlphttp, exporter/exporterqueue, extension/memorylimiter, scraper/scraperhelper
What happened?
Describe the bug Open telemetry internal metrics now emitted via Prometheus exporter of type "counter" doesn't ends with suffix "_total" which leads to Open Telemetry internal metrics are not comply with Prometheus metrics naming conventions as per rules recommended here https://prometheus.io/docs/practices/naming/
`Note As of Collector v0.106.1, internal metric names are handled differently based on their source:
Metrics generated from Collector components are prefixed with otelcol_. Metrics generated from instrumentation libraries do not use the otelcol_ prefix by default, unless their metric names are explicitly prefixed. For Collector versions prior to v0.106.1, all internal metrics emitted using the Prometheus exporter, regardless of their origin, are prefixed with otelcol_. This includes metrics from both Collector components and instrumentation libraries. `
cat metrics.txt | ./promtool check metrics --extended otelcol_exporter_send_failed_log_records counter metrics should have "_total" suffix otelcol_exporter_send_failed_spans counter metrics should have "_total" suffix otelcol_exporter_sent_log_records counter metrics should have "_total" suffix otelcol_exporter_sent_spans counter metrics should have "_total" suffix otelcol_process_cpu_seconds counter metrics should have "_total" suffix otelcol_process_runtime_total_alloc_bytes counter metrics should have "_total" suffix otelcol_process_uptime counter metrics should have "_total" suffix otelcol_processor_accepted_log_records counter metrics should have "_total" suffix otelcol_processor_accepted_spans counter metrics should have "_total" suffix otelcol_processor_batch_timeout_trigger_send counter metrics should have "_total" suffix otelcol_processor_incoming_items counter metrics should have "_total" suffix otelcol_processor_outgoing_items counter metrics should have "_total" suffix otelcol_receiver_accepted_log_records counter metrics should have "_total" suffix otelcol_receiver_accepted_spans counter metrics should have "_total" suffix otelcol_receiver_refused_log_records counter metrics should have "_total" suffix otelcol_receiver_refused_spans counter metrics should have "_total" suffix
Steps to reproduce Enable open telemetry own internal metrics to any level other than "none" via service::telemetry::metrics::level: and see the response of those internal metrics manually using curl as below http://127.0.0.1:8888/metrics Now, you can validate the response using promtool to validate the metrics naming rules
More details about promtool: Prometheus (3PP) ships with a lightweight command-line utility called "Promtool" that helps to lint service metrics for consistency and correctness. Promtool validates metric names, labels, metadata, and types based on Prometheus instrumentation best practices (see https://prometheus.io/docs/practices/naming/ and https://prometheus.io/docs/practices/instrumentation/ for more details).
What did you expect to see? All internal metrics of type "counter" should be suffixed with _total otelcol_exporter_send_failed_log_records_total otelcol_exporter_send_failed_spans_total otelcol_exporter_sent_log_records_total otelcol_exporter_sent_spans_total otelcol_process_cpu_seconds_total otelcol_process_runtime_total_alloc_bytes_total otelcol_process_uptime_total otelcol_processor_accepted_log_records_total otelcol_processor_accepted_spans_total otelcol_processor_batch_timeout_trigger_send_total otelcol_processor_incoming_items_total otelcol_processor_outgoing_items_total otelcol_receiver_accepted_log_records_total otelcol_receiver_accepted_spans_total otelcol_receiver_refused_log_records_total otelcol_receiver_refused_spans_total
What did you see instead? otelcol_exporter_send_failed_log_records counter metrics should have "_total" suffix otelcol_exporter_send_failed_spans counter metrics should have "_total" suffix otelcol_exporter_sent_log_records counter metrics should have "_total" suffix otelcol_exporter_sent_spans counter metrics should have "_total" suffix otelcol_process_cpu_seconds counter metrics should have "_total" suffix otelcol_process_runtime_total_alloc_bytes counter metrics should have "_total" suffix otelcol_process_uptime counter metrics should have "_total" suffix otelcol_processor_accepted_log_records counter metrics should have "_total" suffix otelcol_processor_accepted_spans counter metrics should have "_total" suffix otelcol_processor_batch_timeout_trigger_send counter metrics should have "_total" suffix otelcol_processor_incoming_items counter metrics should have "_total" suffix otelcol_processor_outgoing_items counter metrics should have "_total" suffix otelcol_receiver_accepted_log_records counter metrics should have "_total" suffix otelcol_receiver_accepted_spans counter metrics should have "_total" suffix otelcol_receiver_refused_log_records counter metrics should have "_total" suffix otelcol_receiver_refused_spans counter metrics should have "_total" suffix`
Collector version
0.126.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04") Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Log output
`cat metrics.txt | ./promtool check metrics --extended
otelcol_exporter_send_failed_log_records counter metrics should have "_total" suffix
otelcol_exporter_send_failed_spans counter metrics should have "_total" suffix
otelcol_exporter_sent_log_records counter metrics should have "_total" suffix
otelcol_exporter_sent_spans counter metrics should have "_total" suffix
otelcol_process_cpu_seconds counter metrics should have "_total" suffix
otelcol_process_runtime_total_alloc_bytes counter metrics should have "_total" suffix
otelcol_process_uptime counter metrics should have "_total" suffix
otelcol_processor_accepted_log_records counter metrics should have "_total" suffix
otelcol_processor_accepted_spans counter metrics should have "_total" suffix
otelcol_processor_batch_timeout_trigger_send counter metrics should have "_total" suffix
otelcol_processor_incoming_items counter metrics should have "_total" suffix
otelcol_processor_outgoing_items counter metrics should have "_total" suffix
otelcol_receiver_accepted_log_records counter metrics should have "_total" suffix
otelcol_receiver_accepted_spans counter metrics should have "_total" suffix
otelcol_receiver_refused_log_records counter metrics should have "_total" suffix
otelcol_receiver_refused_spans counter metrics should have "_total" suffix`
Additional context
No response