#5179: Add build tag nometrics and centralize Prometheus imports#5220
Open
filinvadim wants to merge 9 commits intoethersphere:masterfrom
Open
#5179: Add build tag nometrics and centralize Prometheus imports#5220filinvadim wants to merge 9 commits intoethersphere:masterfrom
nometrics and centralize Prometheus imports#5220filinvadim wants to merge 9 commits intoethersphere:masterfrom
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
Author
|
Linter failed to start. |
Author
|
Looks like flapping test. |
Member
|
@filinvadim To make this feature more accessible, I suggest adding support for it in the Makefile. Maybe to add Also, I got an error: |
Author
|
@gacevicljubisa Thanks! Fixed missing |
382f517 to
b4393f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):