-
Notifications
You must be signed in to change notification settings - Fork 279
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
feat(pyroscope.write): Add labels validation #2918
Conversation
b976738
to
00c5c64
Compare
00c5c64
to
874d4db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this.
LGTM
874d4db
to
4879713
Compare
// Skip label name validation for pyroscope reserved labels | ||
if l.Name == pyroscope.LabelName { | ||
lastLabelName = l.Name | ||
continue | ||
} | ||
|
||
// Validate label name | ||
if err := labelset.ValidateLabelName(l.Name); err != nil { | ||
return fmt.Errorf("invalid label name: %w", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Find that easier to read and less error prone
// Skip label name validation for pyroscope reserved labels | |
if l.Name == pyroscope.LabelName { | |
lastLabelName = l.Name | |
continue | |
} | |
// Validate label name | |
if err := labelset.ValidateLabelName(l.Name); err != nil { | |
return fmt.Errorf("invalid label name: %w", err) | |
} | |
// Skip label name validation for pyroscope reserved labels | |
if l.Name != pyroscope.LabelName { | |
// Validate label name | |
if err := labelset.ValidateLabelName(l.Name); err != nil { | |
return fmt.Errorf("invalid label name: %w", err) | |
} | |
} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you disagree, just ignore
4879713
to
9ecf5e0
Compare
9ecf5e0
to
fbee43d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Description
This PR adds validation for labels in the
pyroscope.write
component to ensure compatibility with Pyroscope's validation requirements. The validation:Which issue(s) this PR fixes
https://github.com/grafana/pyroscope-squad/issues/357
Notes to the Reviewer
service_name
label existence. As talked, as far as using thereceive_http
, this should come for free with ourensureServiceName
function and also validated at pyroscope side.PR Checklist