[Exporter.Prometheus] Improve UTF-8 escaping performance - #7758
Merged
martincostello merged 3 commits intoSep 18, 2026
Merged
martincostello merged 3 commits into
martincostello merged 3 commits into
Conversation
Improve the performance of escaping UTF-8 values during serialization to be `O(n)` instead of `O(n^2)` when targeting modern .NET.
martincostello
commented
Sep 15, 2026
martincostello
commented
Sep 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7758 +/- ##
==========================================
- Coverage 91.87% 91.85% -0.03%
==========================================
Files 339 339
Lines 18468 18469 +1
==========================================
- Hits 16967 16964 -3
- Misses 1501 1505 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Add PR number.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The performance claim needs before-and-after benchmark results.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Optimizes shared Prometheus UTF-8 escaping by scanning input once.
Changes:
- Replaces dual searches with one verbatim-character search.
- Documents the optimization for both exporter packages.
File summaries
| File | Description |
|---|---|
TextFormatSerializer.cs |
Implements linear escaping scan. |
HttpListener CHANGELOG.md |
Records the optimization. |
AspNetCore CHANGELOG.md |
Records the shared optimization. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
martincostello
marked this pull request as ready for review
September 16, 2026 15:39
martincostello
enabled auto-merge
September 16, 2026 15:39
Pull request dashboard statusMerged · refreshed 2026-09-18 10:16 UTC Status above doesn't look right?
|
Kielek
approved these changes
Sep 18, 2026
This was referenced Sep 18, 2026
This was referenced Sep 29, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Improve the performance of escaping UTF-8 values during serialization to be
O(n)instead ofO(n^2)when targeting modern .NET.Benchmarks
Merge requirement checklist
Unit tests added/updatedCHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)