opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

[mdatagen] Add semconv reference for metrics in metadata schema

Open ChrsMark opened this issue 1 month ago • 3 comments
trafficstars

Description

This PR adds support in mdatagen for defining SemConv reference for metrics.

Enhancing your metrics/signals in metadata.yaml like bellow:

metrics:
  system.cpu.time:
    enabled: true
    stability:
      level: beta
    description: Monotonic cumulative sum int metric enabled by default.
    unit: s
    sum:
      value_type: int
      monotonic: true
      aggregation_temporality: cumulative
    semantic_convention:
      semconv_ref: https://github.com/open-telemetry/semantic-conventions/blob/v1.37.0/docs/system/system-metrics.md#metric-systemcputime

Will provide the following generated docs:

system.cpu.time

Monotonic cumulative sum int metric enabled by default.

Unit Metric Type Value Type Aggregation Temporality Monotonic Stability Semantic Convention
s Sum Int Cumulative true beta system.cpu.time

Validation is added so as to ensure that provided SemConv urls match the top_level semconv version as well as the metric's name.

Link to tracking issue

Related to https://github.com/open-telemetry/opentelemetry-collector/issues/13910 and https://github.com/open-telemetry/opentelemetry-collector/issues/13297.

Testing

Tuned

Documentation

Tuned

ChrsMark avatar Sep 30 '25 13:09 ChrsMark