open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.18k stars 753 forks source link

[prometheus] Support meter-level tags #5837

Closed robertcoltheart closed 4 days ago

robertcoltheart commented 1 week ago

Fixes #

5836

Changes

Adds meter-level tags to Prometheus exporter. Any tags added to meter are automatically added to scrape output.

Merge requirement checklist

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.30%. Comparing base (6250307) to head (45cb7fc). Report is 322 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837/graphs/tree.svg?width=650&height=150&src=pr&token=vscyfvPfy5&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ```diff @@ Coverage Diff @@ ## main #5837 +/- ## ========================================== + Coverage 83.38% 86.30% +2.91% ========================================== Files 297 257 -40 Lines 12531 11172 -1359 ========================================== - Hits 10449 9642 -807 + Misses 2082 1530 -552 ``` | [Flag](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `?` | | | [unittests-Project-Experimental](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `86.25% <100.00%> (?)` | | | [unittests-Project-Stable](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `85.92% <100.00%> (?)` | | | [unittests-UnstableCoreLibraries-Experimental](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `85.75% <100.00%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [...heus.HttpListener/Internal/PrometheusSerializer.cs](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837?src=pr&el=tree&filepath=src%2FOpenTelemetry.Exporter.Prometheus.HttpListener%2FInternal%2FPrometheusSerializer.cs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL09wZW5UZWxlbWV0cnkuRXhwb3J0ZXIuUHJvbWV0aGV1cy5IdHRwTGlzdGVuZXIvSW50ZXJuYWwvUHJvbWV0aGV1c1NlcmlhbGl6ZXIuY3M=) | `87.15% <100.00%> (+2.28%)` | :arrow_up: | ... and [224 files with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-dotnet/pull/5837/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)
robertcoltheart commented 5 days ago

I've added some additional tests as requested. I think a follow-up PR is required to refactor these tests a bit, since we have quite a few different combinations of conditions.