Skip to content

Bound HTTP method metric labels to a fixed set - #2

Merged
abnegate merged 1 commit into
mainfrom
cursor/bound-http-method-metric-label-a5b2
Oct 22, 2026
Merged

abnegate merged 1 commit into
mainfrom
cursor/bound-http-method-metric-label-a5b2

Conversation

@abnegate

Copy link
Copy Markdown
Member

What does this PR do?

instrument() used the request method as a Prometheus label on exiftool_http_requests_total and exiftool_http_request_duration_seconds. Routes are already normalized by telemetryRoute(); methods were not, so each distinct method token created a new series.

This maps the method label to the standard HTTP methods and folds anything else into other, keeping method-label cardinality bounded. The structured request log still records the original method, truncated when it is unusually long.

Test Plan

  • Regression test sends 64 distinct non-standard methods plus GET and POST, then asserts both HTTP metrics keep a bounded method-label set (GET, POST, and other).
  • Unit tests for telemetryMethod and loggedMethod.
  • go test -race ./..., go vet ./..., and gofmt on the changed files.
Open in Web Open in Cursor 

Map request methods used as Prometheus labels to the standard HTTP
methods and fold everything else into "other". Truncate long method
tokens in the request completion log so those fields stay bounded too.

Co-authored-by: Jake Barnby <abnegate@users.noreply.github.com>

Copy link
Copy Markdown
Member Author

@hansi-codes review

@hansi-codes

hansi-codes Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The changed behavior is bounded as intended and has direct regression coverage.

HTTP request metrics now normalize methods to a fixed set of standard methods plus an other bucket. Request-completion logs retain the original method while truncating unusually long values, and new tests cover the normalization, truncation, and metric-label cardinality.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
cmd/exiftool-server/telemetry.go Normalize method labels for HTTP metrics and bound the method value written to request logs.
cmd/exiftool-server/telemetry_test.go Add tests for bounded metric method labels, method normalization, and log truncation.

Reviewed 5852c49 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@abnegate
abnegate marked this pull request as ready for review October 22, 2026 23:08
@abnegate
abnegate merged commit 6625881 into main Oct 22, 2026
4 checks passed
@abnegate
abnegate deleted the cursor/bound-http-method-metric-label-a5b2 branch October 22, 2026 23:08
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