Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prometheus Exporter for Metrics not correctly grouping by #TYPE #2289

Closed
jammiemil opened this issue Aug 26, 2021 · 3 comments
Closed

Prometheus Exporter for Metrics not correctly grouping by #TYPE #2289

jammiemil opened this issue Aug 26, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@jammiemil
Copy link

jammiemil commented Aug 26, 2021

Bug Report

List of NuGet packages and
version that you are using (e.g. OpenTelemetry 1.0.2):
https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/examples/Console/TestPrometheusExporter.cs
1.2.0-alpha2

Runtime version (e.g. net461, net48, netcoreapp3.1, net5.0 etc. You can
find this information from the *.csproj file):

netcoreapp3.1

Symptom

Using sample code before we start instrumenting our application and the Prometheus Exporter is putting the counter metrics into separate TYPE headers rather than grouping them which causes issues when scraping

What is the expected behavior?

# TYPE myHistogram histogram
myHistogram_sum{tag1="value1",tag2="value2"} 427194 1630007523788
myHistogram_count{tag1="value1",tag2="value2"} 547 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="0"} 0 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="5"} 0 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="10"} 0 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="25"} 5 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="50"} 11 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="75"} 17 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="100"} 21 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="250"} 88 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="500"} 175 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="1000"} 344 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="+Inf"} 547 1630007523788
# TYPE myCounter counter
myCounter{tag1="value1",tag2="value2"} 5470 1630007523790
myCounter{tag1="anothervalue",tag2="somethingelse"} 54700 1630007523792
# TYPE Gauge gauge
Gauge{tag1="value1",tag2="value2"} 760 1630007523793

What is the actual behavior?

# TYPE myHistogram histogram
myHistogram_sum{tag1="value1",tag2="value2"} 427194 1630007523788
myHistogram_count{tag1="value1",tag2="value2"} 547 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="0"} 0 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="5"} 0 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="10"} 0 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="25"} 5 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="50"} 11 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="75"} 17 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="100"} 21 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="250"} 88 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="500"} 175 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="1000"} 344 1630007523788
myHistogram_bucket{tag1="value1",tag2="value2",le="+Inf"} 547 1630007523788
# TYPE myCounter counter
myCounter{tag1="value1",tag2="value2"} 5470 1630007523790
# TYPE myCounter counter
myCounter{tag1="anothervalue",tag2="somethingelse"} 54700 1630007523792
# TYPE Gauge gauge
Gauge{tag1="value1",tag2="value2"} 760 1630007523793

Reproduce

Recreated using:

https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/examples/Console/TestPrometheusExporter.cs

with flags:
Examples.Console.exe prometheus -d 60

Additional Context

We are just starting to Instrument this application and whilst the OpenTelemetry-dotnet package doesn't have mainstream metrics support yet we are hoping to be able to use one package for metrics/logs/traces to avoid bloat so looking to be early adopters of this functionality!

NB. Updated to put the expected/actual behaviour the right way around in case anyone else comes across this issue and doesnt realise i messed up the ordering.

@jammiemil jammiemil added the bug Something isn't working label Aug 26, 2021
@jammiemil jammiemil changed the title Prometheus Exporter not correctly grouping by #TYPE Prometheus Exporter for Metrics not correctly grouping by #TYPE Aug 26, 2021
@cijothomas
Copy link
Member

Thanks! this is known issue for prometheus now (#2282 (comment))

Will be fixing this for next release.

@jammiemil
Copy link
Author

Awesome thank you, i thought it might be known but couldnt see an issue for it :)

Any ideas on the timeline for that release? We started going down a seperate rabbit hole with OTLP in the meantime but if we know this will be fixed in the near future we can just park it for now.

@cijothomas
Copy link
Member

I expect it to be part of the next alpha3 release, which is coming next Friday
https://github.com/open-telemetry/opentelemetry-dotnet/milestone/26

(since we are still in alpha, issues are not really created for known issues as there'll be too many issues to track!. once we reach beta stage (mid september), we'll have issues opened for better tracking)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants