tracer: align go labels validation with upstream PR #1454#289
Merged
Conversation
The parca fork merged an earlier iteration of open-telemetry#1454 in fork PR #278. Upstream went through additional review rounds that reshaped the code without changing the user-visible behaviour: - Pull custom label validation out of tracer.go into a customLabelValidator type (tracer/labels.go), so the Tracer struct no longer carries per-feature atomic counters. Type and methods are unexported and the name is generic rather than Go-specific; non-Go custom label consumers can use the same validator. - Validators return ([]byte, bool) and let the caller intern, so the validator has no dependency on libpf string internals. - Share the cstring NUL-trim helper between goString and the validator. - Tests split: tracer/labels_test.go covers the validator (including drop counter increments and GetAndResetMetrics), tracer/string_test.go covers only goString. No behaviour change vs the fork-merged version. Metric IDs remain at the fork-specific values (IDGoLabelsDroppedInvalidName/Value), as those were already reserved past upstream's range.
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 fork merged an earlier iteration of #1454 in fork PR #278. Upstream went through additional review rounds and the version that landed on upstream main looks structurally different from what's on parca-dev/main, even though the user-visible behaviour is identical. This PR brings the fork in line with the upstream-merged shape so the next upstream merge is conflict-free.
What changed (no behaviour change):
Metric IDs stay at the fork-specific values (`IDGoLabelsDroppedInvalidName` / `IDGoLabelsDroppedInvalidValue`) — those were already reserved past upstream's range when fork PR #278 landed, and don't need to change.
Test plan