open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.94k stars 1.32k forks source link

[mdatagen] use mdatagen to produce component internal telemetry #10054

Closed codeboten closed 2 weeks ago

codeboten commented 2 weeks ago

Description

This updates mdatagen to generate internal telemetry for components based on metadata.yaml configuration.

Testing

Added tests to mdatagen and updated the batch processor to use this as well for synchronous counters and histogram

codeboten commented 2 weeks ago

Thanks @songy23, will wait to get feedback on the rest of the PR before fixing to ensure contributors are ok with this approach. One of the annoying things is that most of the internal telemetry is defined in helper packages, which don't currently have metadata.yaml configuration since they're not components. This is a solvable problem, but I do want to raise this as something that will have to change.

Ideally I would like to see internal telemetry generated by *helper packages listed in the documentation for components that use them. For example, i would like to see exporter_sent_log_records listed as a metric that is emitted by every exporter in their documentation. I think it would make it easier for end users to understand the telemetry their pipelines emit, than to have to search for the helper's documentation. Alternatively a link from one to the other works too :)

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 50.00000% with 38 lines in your changes are missing coverage. Please review.

Project coverage is 91.67%. Comparing base (109173d) to head (6e2018b).

Files Patch % Lines
cmd/mdatagen/metricdata.go 9.52% 18 Missing and 1 partial :warning:
...ereceiver/internal/metadata/generated_telemetry.go 0.00% 17 Missing :warning:
cmd/mdatagen/loader.go 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #10054 +/- ## ========================================== - Coverage 91.87% 91.67% -0.21% ========================================== Files 360 360 Lines 16730 16775 +45 ========================================== + Hits 15371 15378 +7 - Misses 1021 1058 +37 - Partials 338 339 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.