feat: OM2 writer outputs names as provided, no suffix appending#1957
Open
zeitlinger wants to merge 3 commits intomainfrom
Open
feat: OM2 writer outputs names as provided, no suffix appending#1957zeitlinger wants to merge 3 commits intomainfrom
zeitlinger wants to merge 3 commits intomainfrom
Conversation
7 tasks
8a18993 to
23a0eb4
Compare
Move metric name suffix handling (_total, _info, unit suffixes) from creation time to scrape time. Each format writer now owns its suffix conventions: - OM1: smart-appends suffixes (skip if already present) - Registry detects cross-format name collisions at registration time Key changes: - Remove all reserved metric name suffixes from PrometheusNaming - Store original user-provided name separately from exposition base name in MetricMetadata (originalName vs expositionBaseName) - Smart-append logic in OM1/protobuf writers for _total and _info - Two-layer collision detection in PrometheusRegistry Closes #1941 Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
- Fix race condition: use putIfAbsent for atomic exposition name claiming with proper rollback on failure - Extract claimExpositionNames/releaseExpositionNames for single rollback path - Rename Info test methods to reflect that _info suffix is now allowed Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The OM2 writer now uses expositionBaseName instead of appending _total (counters) or unit suffixes. The _info suffix is enforced per the OM2 spec (MUST). Tests updated to verify OM2-specific output rather than asserting identity with OM1. Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
23a0eb4 to
9fb30c8
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.
Summary
The OM2 writer now uses
expositionBaseNamedirectly instead ofappending
_total(counters) or unit suffixes. The_infosuffixis enforced per the OM2 spec (MUST). Part of #1942.
Key table
Counter("events")events_totaleventsCounter("events_total")events_totalevents_totalCounter("req").unit(BYTES)req_bytes_totalreq_bytesCounter("req_bytes").unit(BYTES)req_bytes_totalreq_bytesGauge("events_total")events_totalevents_totalInfo("target")target_infotarget_infoPR stack
preserve_names(independent)Test plan
mise run compilepasses_total/unit suffix appending_infosuffix enforcement testedPart of #1912.