-
Notifications
You must be signed in to change notification settings - Fork 379
#5179: Add build tag nometrics and centralize Prometheus imports
#5220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
nometrics and centralize Prometheus importsnometrics and centralize Prometheus imports
Introduced a nometrics build tag with two alternative implementations: a no-op stub when metrics are disabled and the full Prometheus-backed implementation when enabled. Removed scattered Prometheus imports across the codebase. Centralized all metric definitions and Prometheus types under pkg/metrics with local aliases to ensure the rest of the project depends only on this package. This makes it possible to build and run the project without pulling in Prometheus (via -tags nometrics), while keeping metrics fully functional by default and isolating Prometheus-specific code in a single place.
903a8fe to
89a2ea3
Compare
|
Linter failed to start. |
|
Looks like flapping test. |
|
@filinvadim To make this feature more accessible, I suggest adding support for it in the Makefile. Maybe to add Also, I got an error: |
|
@gacevicljubisa Thanks! Fixed missing |
382f517 to
b4393f5
Compare
Checklist
Description
Introduced a
nometricsbuild tag to allow tinygo compilation. Removed scattered Prometheus imports across the codebase. Centralized all metric definitions and Prometheus types underpkg/metrics, with local aliases to ensure the rest of the project depends only on this package.NO performance optimizations. NO functionality changed. Code refactorings only.
Fully backwards-compatible: default builds behave exactly as before.
No breaking changes for downstream users relying on metrics.
Verified with go test ./... both with and without -tags nometrics
Open API Spec Version Changes (if applicable)
None
Motivation and Context (Optional)
This makes it possible to build and run the project without pulling in Prometheus (for tinygo compilation for example), while keeping metrics fully functional by default and isolating Prometheus-specific code in a single place.
Related Issue (Optional)
Use a build tag to toggle Prometheus/metrics
Screenshots (if appropriate):