Review commit 6378fee - no fixes, report only #2
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.
Per the problem statement, this PR reviews commit 6378fee which adds Prometheus v2 output with metric labels to
stats_over_http. No fixes are applied - this is a review-only report.Issues Identified
1. Missing Accept Header Support for Prometheus v2
Commit message claims v2 is accessible via
Accept: version=2.0.0header, but code only handlesversion=0.0.4(v1). The Accept header parsing (lines 1066-1072) never setsPROMETHEUS_V2_OUTPUT.2. Buffer Over-read in Debug Statement
Line 1051 uses
request_path_suffix.data()without length in format string:Should use
%.*swith explicit length forstring_view.3. TYPE Metadata Inconsistency
Line 723 determines Prometheus TYPE by first metric seen with a base name. Metrics with identical base names but different types (COUNTER vs INT vs FLOAT) will get incorrect TYPE declarations for all but the first.
4. Unescaped Prometheus Label Values
add_labellambda (line 575-580) doesn't escape",\, or\nin label values per Prometheus spec. Metrics containing these characters will produce malformed output.5. Missing Hash Function
prometheus_v2_metricstruct definesoperator==but no hash function. Not currently an issue but incomplete for future use in unordered containers.6. Incomplete Documentation
RST docs don't mention Accept header for v2 format, only path-based access.
Priority
Critical: #1 (feature doesn't work as documented)
High: #2 (security), apache#4 (correctness)
Medium: #3 (correctness)
Low: apache#5, apache#6
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.