Skip to content

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Sep 30, 2025

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 #13297 and #13910.

Testing

Tuned

Documentation

Tuned

Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 86.08696% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.63%. Comparing base (5ec1466) to head (d1ca767).

Files with missing lines Patch % Lines
cmd/mdatagen/internal/metric.go 51.51% 11 Missing and 5 partials ⚠️

❌ Your patch check has failed because the patch coverage (86.08%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13920      +/-   ##
==========================================
- Coverage   91.67%   91.63%   -0.05%     
==========================================
  Files         652      652              
  Lines       42516    42626     +110     
==========================================
+ Hits        38977    39060      +83     
- Misses       2731     2750      +19     
- Partials      808      816       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ChrsMark ChrsMark changed the title [mdatagen] Add semconv reference for signals in metadata schema [mdatagen] Add semconv reference for metrics in metadata schema Sep 30, 2025
Signed-off-by: ChrsMark <[email protected]>
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like this change a lot. would be great to get this in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants