[Prometheus compatibility] Do not require trimming suffixes by default #3580
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of open-telemetry/wg-prometheus#72
Changes
We currently require Prometheus -> OpenTelemetry translation to remove type and unit suffixes in metric names. For example, the Prometheus metric
http_request_duration_seconds_total
would becomehttp_request_duration
in the resulting OTel metric. When this change was made, it received a large amount of user pushback, as it broke many existing metric names.This PR makes trimming suffixes from names disabled by default, and encourages implementations to provide a config knob to enable the suffix trimming.
The original motivation for trimming suffixes by default was so that metrics could be round-tripped between an OTel SDK and the collector through the prometheus endpoint. For example, the OTel metric
process.network.io
becomesprocess_network_io_bytes_total
with type and unit suffixes. When converting that back to OpenTelemetry, trimming suffixes would result inprocess_network_io
, which is close to the original OpenTelemetry metric name, but isn't the same as the original.We would like to make the removal of suffixes disabled by default because:
.
are substituted for_
.cc @open-telemetry/wg-prometheus @jmacd @gouthamve