diff --git a/specification/metrics/data-model.md b/specification/metrics/data-model.md index bcae7e2504e..ac19614542d 100644 --- a/specification/metrics/data-model.md +++ b/specification/metrics/data-model.md @@ -1388,13 +1388,11 @@ exemplar as attributes. Each metric matching `_opentelemetry_scope_info` present in a batch of metrics SHOULD be dropped from the incoming scrape, and converted to an instrumentation scope. The `name` and `version` labels, if present MUST be converted to the -Name and Version of the Instrumentation Scope. The prefix of the metric MUST be -added to the Instrumentation Scope as the value for the `scope.short_name` -attribute. Additional labels MUST be added as scope attributes, with keys and -values unaltered. Other metrics in the batch which have a prefix equal to the -prefix of the `_opentelemetry_scope_info` metric have the matching prefix -removed, and are placed within that Instrumentation Scope. For example, the -OpenMetrics metrics: +Name and Version of the Instrumentation Scope. Additional labels MUST be added +as scope attributes, with keys and values unaltered. Other metrics in the batch +which have a prefix equal to the prefix of the `_opentelemetry_scope_info` +metric have the matching prefix removed, and are placed within that Instrumentation +Scope. For example, the OpenMetrics metrics: ``` # TYPE otelhttp_opentelemetry_scope_info info @@ -1412,7 +1410,6 @@ scope_metrics: name: go.opentelemetry.io.contrib.instrumentation.net.http.otelhttp version: v0.24.0 attributes: - scope.short_name: otelhttp library_mascot: bear metrics: - name: http_server_duration @@ -1483,18 +1480,22 @@ It also dictates type-specific conversion rules listed below. OpenMetrics prevents naming collisions for metrics from different libraries by adding a [metric namespace](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#metric-naming-and-namespaces), -which is generally a single-word prefix, to metrics. The -[`scope.short_name` scope attribute](../scope/README.md#scope-semantic-conventions), -serves the same purpose. `_`, if present, MUST be attached as a -prefix to all metrics from an Instrumentation Scope. - -For each Instrumentation Scope with a `scope.short_name` attribute, Prometheus -exporters SHOULD generate an [Info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#info)-typed -metric named `_opentelemetry_scope_info`. If multiple -Instrumentation Scopes within the batch of metrics being scraped have the same -`scope.short_name`, do not generate either metric. If present, Instrumentation +which is generally a single-word prefix, to metrics. The Instrumentation Scope +serves a similar purpose in OpenTelemetry, but is too long to be practical as a +prefix to metrics. Prometheus exporters MUST add a prefix to all metrics within +an instrumentation scope based on the instrumentation scope name. It is +recommended to use the last word of the Instrumentation Scope name. For +example, a scope with the name +`go.opentelemetry.io.contrib.instrumentation.net.http.otelhttp` would result in +`otelhttp_` being added as a prefix to metrics within that scope. + +For each Instrumentation Scope, Prometheus exporters SHOULD generate an +[Info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#info)-typed +metric named `_opentelemetry_scope_info` using the same prefix used +above. If multiple Instrumentation Scopes within the batch of metrics being +scraped would have the same prefix, do not generate either metric. If present, Instrumentation Scope `name` and `version` MUST be added as `name` and `version` labels. Values -for `name` and `version` labels, as well as additional scope attributes (other than `scope.short_name`) MUST be added +for `name` and `version` labels, as well as scope attributes MUST be added following the rules described in the [`Metric Attributes`](#metric-attributes) section below.