Skip to content

Commit

Permalink
remove short_name, and use last word of scope name
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Aug 31, 2022
1 parent 0fcb120 commit 6a7866b
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions specification/metrics/data-model.md
Expand Up @@ -1388,13 +1388,11 @@ exemplar as attributes.
Each metric matching `<prefix>_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 `<prefix>_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 `<prefix>_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
Expand All @@ -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
Expand Down Expand Up @@ -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. `<scope.short_name>_`, 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 `<scope.short_name>_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 `<prefix>_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.

Expand Down

0 comments on commit 6a7866b

Please sign in to comment.