Skip to content

Conversation

Copy link

Copilot AI commented Jan 8, 2026

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.0 header, but code only handles version=0.0.4 (v1). The Accept header parsing (lines 1066-1072) never sets PROMETHEUS_V2_OUTPUT.

2. Buffer Over-read in Debug Statement

Line 1051 uses request_path_suffix.data() without length in format string:

Dbg(dbg_ctl, "Path had explicit format, ignoring any Accept header: %s", request_path_suffix.data());

Should use %.*s with explicit length for string_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_label lambda (line 575-580) doesn't escape ", \, or \n in label values per Prometheus spec. Metrics containing these characters will produce malformed output.

5. Missing Hash Function

prometheus_v2_metric struct defines operator== 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

Review commit 6378fee. Don't fix anything just tell me if anything is wrong.


💡 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.

itsh3sam and others added 2 commits January 8, 2026 19:06
The current Prometheus output in stats_over_http dumps flattened metric
names (e.g., proxy.process.http.200_responses), which makes it difficult
to aggregate data in Grafana or Prometheus. This adds a new "v2" output
format that parses these names into proper labels like
status="200" or method="GET".

The new format can be accessed via /_stats/prometheus_v2 or by passing
an Accept header with version=2.0.0.

To keep this efficient, the parsing uses swoc::TextView for a zero-
allocation approach. It recognizes common ATS patterns such as status
codes, HTTP methods, cache results, and thread/volume indices. I've
also added deduplication for the HELP and TYPE metadata lines, so that
metrics sharing the same base name (but different labels) are grouped
correctly in the output.

Includes compile-time unit tests (static_assert) to verify the parsing
logic and updated AuTests for the new endpoint.
Copilot AI changed the title [WIP] Review commit 6378fee for potential issues Review commit 6378fee - no fixes, report only Jan 8, 2026
Copilot AI requested a review from itsh3sam January 8, 2026 15:43
@itsh3sam itsh3sam closed this Jan 8, 2026
@itsh3sam itsh3sam deleted the copilot/review-commit-6378fee branch January 8, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants