Skip to content

[Exporter.Prometheus] Fix crashes on empty label names - #7077

Merged
martincostello merged 3 commits into
open-telemetry:mainfrom
ysolomchenko:Prometheus-exporter-crashes-on-empty-label-names
Apr 14, 2026
Merged

martincostello merged 3 commits into
open-telemetry:mainfrom
ysolomchenko:Prometheus-exporter-crashes-on-empty-label-names

Conversation

@ysolomchenko

@ysolomchenko ysolomchenko commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes # N/A
Design discussion issue # N/A

Found by Codex/security scans.

Changes

Fixed Prometheus metric serialization to handle empty label names without throwing during scrape rendering.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions Bot added the pkg:OpenTelemetry.Exporter.Prometheus.HttpListener Issues related to OpenTelemetry.Exporter.Prometheus.HttpListener NuGet package label Apr 14, 2026
@ysolomchenko
ysolomchenko marked this pull request as ready for review April 14, 2026 13:04
@ysolomchenko
ysolomchenko requested a review from a team as a code owner April 14, 2026 13:04
@codecov

codecov Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.73%. Comparing base (6ebefc0) to head (3375e89).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7077      +/-   ##
==========================================
+ Coverage   88.65%   88.73%   +0.08%     
==========================================
  Files         270      270              
  Lines       12915    12920       +5     
==========================================
+ Hits        11450    11465      +15     
+ Misses       1465     1455      -10     
Flag Coverage Δ
unittests-Project-Experimental 88.53% <100.00%> (-0.07%) ⬇️
unittests-Project-Stable 88.61% <100.00%> (-0.04%) ⬇️
unittests-UnstableCoreLibraries-Experimental 41.20% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...heus.HttpListener/Internal/PrometheusSerializer.cs 87.77% <100.00%> (+0.20%) ⬆️

... and 6 files with indirect coverage changes

@martincostello
martincostello added this pull request to the merge queue Apr 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 14, 2026
@martincostello
martincostello added this pull request to the merge queue Apr 14, 2026
Merged via the queue into open-telemetry:main with commit 9c5d96d Apr 14, 2026
62 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution @ysolomchenko! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

@Kielek

Kielek commented Apr 14, 2026

Copy link
Copy Markdown
Member

I think that you should update also the second prometheus exporter changelog

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

Labels

pkg:OpenTelemetry.Exporter.Prometheus.HttpListener Issues related to OpenTelemetry.Exporter.Prometheus.HttpListener NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants