Skip to content

Commit

Permalink
handle instrumentation scope in prometheus conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Mar 17, 2022
1 parent 7680667 commit abb65d2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions specification/metrics/datamodel.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
+ [Dropped Data Points](#dropped-data-points)
+ [Metric Attributes](#metric-attributes)
+ [Exemplars](#exemplars-2)
+ [Instrumentation Scope](#instrumentation-scope)
+ [Resource Attributes](#resource-attributes-1)
- [Footnotes](#footnotes)

Expand Down Expand Up @@ -1182,6 +1183,11 @@ retrieved from the `trace_id` and `span_id` label keys, respectively. All
labels not used for the trace and span ids MUST be added to the OpenTelemetry
exemplar as attributes.

#### Instrumentation Scope

Instrumentation Scope MUST be left unset for metrics scraped from Prometheus
endpoints.

#### Resource Attributes

When scraping a Prometheus endpoint, resource attributes MUST be added to the
Expand Down Expand Up @@ -1284,6 +1290,17 @@ OpenMetrics exemplar, and `filtered_attributes` MUST be added as labels on the
OpenMetrics exemplar unless they would exceed the OpenMetrics
[limit on characters](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars).

#### Instrumentation Scope

The OpenMetrics equivalent of Instrumentation Scope is the
[metric namespace](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#metric-naming-and-namespaces),
which is a single-word prefix for metrics which identifies the source of the
metric. However, the Instrumentation Scope Name in OpenTelemetry isn't
generally suitable to use as a prefix because of how verbose it is. Exporters
MUST not attach the instrumentation scope name as a prefix or label to metrics.
The Instrumentation Scope MAY be added as an info-type metric family with the
name "opentelemetry_instrumentation_scope", and labels "name" and "version".

#### Resource Attributes

In SDK Prometheus (pull) exporters, resource attributes SHOULD be converted to the ["target" info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems) metric family; otherwise, they MUST be dropped, and MUST NOT be attached as labels to other metric families. The "target" info metric family MUST be an info-typed metric family whose labels MUST include the resource attributes, and MUST NOT include any other labels. There MUST be at most one "target" info metric family exposed on a Prometheus endpoint.
Expand Down

0 comments on commit abb65d2

Please sign in to comment.