Skip to content

feat: add --web.nginx-metrics-only flag#1241

Open
jensschulze wants to merge 1 commit intonginx:mainfrom
jensschulze:feat/runtime-metrics-optional
Open

feat: add --web.nginx-metrics-only flag#1241
jensschulze wants to merge 1 commit intonginx:mainfrom
jensschulze:feat/runtime-metrics-optional

Conversation

@jensschulze
Copy link

@jensschulze jensschulze commented Jan 27, 2026

Proposed changes

Add a flag ---web.nginx-metrics-only. When the flag is set, export only Nginx metrics and skip all others.

Motivation

We run this exporter (alongside others, also written in Go) in a Kubernetes environment using Kuma as the service mesh.
Metrics are aggregated per pod via Kuma sidecar's metrics-hijacker feature.

When multiple containers within the same pod expose Go runtime metrics, promhttp metrics, etc., these metrics automatically receive the Kuma sidecar’s labels. As a result, Prometheus reports duplicated metrics. This issue occurs consistently in our setup. We identified two possible approaches:

  1. Discard any Go runtime metrics with Prometheus rules. (Just no)
  2. Add custom labels to the Go runtime metrics. (More complex and kind of odd)
  3. Make the emission of Go runtime metrics by the exporters optional. (Simple to implement, small trade-off)

After evaluating these options, we decided to support disabling Go runtime metrics in the exporters.

Checklist

  • I have read the CONTRIBUTING guide
  • I have proven my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have ensured the README is up to date
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch on my own fork

* Skip exporting any non-NGINX metrics when `--web.nginx-metrics-only` is set.
@jensschulze jensschulze requested a review from a team as a code owner January 27, 2026 20:51
@nginx-bot
Copy link

nginx-bot bot commented Jan 27, 2026

Hi @jensschulze! Welcome to the project! 🎉

Thanks for opening this pull request!
Be sure to check out our Contributing Guidelines while you wait for someone on the team to review this.

@nginx-bot nginx-bot bot added the community Issues or PRs opened by an external contributor label Jan 27, 2026
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

✅ All required contributors have signed the F5 CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

@github-actions github-actions bot added enhancement Pull requests for new features/feature enhancements documentation Pull requests/issues for documentation labels Jan 27, 2026
@jensschulze
Copy link
Author

I have hereby read the F5 CLA and agree to its terms

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

Labels

community Issues or PRs opened by an external contributor documentation Pull requests/issues for documentation enhancement Pull requests for new features/feature enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant