Skip to content

Add route and gateway metadata to nginx.http.requests - #1971

Open
NutsaB wants to merge 2 commits into
nginx:mainfrom
NutsaB:feat/ngf-route-metrics
Open

NutsaB wants to merge 2 commits into
nginx:mainfrom
NutsaB:feat/ngf-route-metrics

Conversation

@NutsaB

@NutsaB NutsaB commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Adds Kubernetes Gateway API route and gateway identity attributes (nginx.route.* and nginx.gateway.*) to the nginx.http.requests metric. Aggregates per-route request counts from access logs.
To populate route and gateway metadata, NGINX Gateway Fabric access logs must be written to a regular file on a shared volume rather than the default /dev/stdout destination.
Stub status scraper continues to emit global totals. If access log file destination is not configured, existing stub status metrics are uninterrupted.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@NutsaB
NutsaB requested a review from a team as a code owner October 9, 2026 11:36
@github-actions github-actions Bot added chore Pull requests for routine tasks documentation Improvements or additions to documentation enhancement New feature or request labels Oct 9, 2026
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.99%. Comparing base (d33070e) to head (9a301e3).

Files with missing lines Patch % Lines
...inxreceiver/internal/metadata/generated_metrics.go 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1971      +/-   ##
==========================================
- Coverage   89.00%   88.99%   -0.01%     
==========================================
  Files         111      111              
  Lines       12457    12489      +32     
==========================================
+ Hits        11087    11115      +28     
- Misses       1368     1372       +4     
  Partials        2        2              
Files with missing lines Coverage Δ
...er/internal/scraper/accesslog/nginx_log_scraper.go 88.59% <100.00%> (+1.87%) ⬆️
...internal/scraper/stubstatus/stub_status_scraper.go 97.82% <100.00%> (ø)
...inxreceiver/internal/metadata/generated_metrics.go 92.55% <91.66%> (-0.09%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d33070e...9a301e3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sjberman

sjberman commented Oct 9, 2026

Copy link
Copy Markdown

Hmm, I don't know if I like the fact that this is only possible by writing to a file. With lots of traffic, that file will get huge, fast.

Is this something we just aren't going to be able to do right now? It feels like we need a change to core nginx in order to add metadata to metrics.

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

Labels

chore Pull requests for routine tasks documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants