-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Promtail: add static labels in stage #4495
Conversation
71f8f70
to
f04a4cb
Compare
@dannykopping I am not able to figure out if build failed because of my changes. |
Restarted the build, let's see |
@dannykopping Can you please review it? |
Yes, I will review it as soon as I have some time - it may take a few days unfortunately. |
return errors.New(ErrEmptyStaticLabelStageConfig) | ||
} | ||
for labelName, labelSrc := range c { | ||
if !model.LabelName(labelName).IsValid() { |
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.
Can we also validate the label value ?
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.
I have added label-value validation in Process()
function.
} | ||
// If no label source was specified, use the key name | ||
if labelSrc == nil || *labelSrc == "" { | ||
lName := labelName |
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.
What;s the use case ?
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.
I just took the idea from labels.go
.
If no label-value is specified, we can just use the label-name as label-value.
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.
I think we should keep this explicit. If folks want a label/value combination of the same value, they should define it as such.
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.
Please remove this @sankalp-r
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.
@dannykopping How should we handle the case when labelSrc is nil
?
It will cause error if we try to access nil
value in Process
function.
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.
We should skip the label in that case IMO
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.
@dannykopping Added skip logic in the Process
function.
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.
Looking good !
can't you answer my feedbacks and also introduce the new documentation section required for this.
Thanks !
1a83bac
to
59fcecf
Compare
59fcecf
to
12d3ac0
Compare
I have added documentation section. Please have a look. |
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.
@sankalp-r this looks great, thanks for your contribution!
I've added a few minor spelling corrections, and added to the question asked by Cyril. Once we have all those fixed up this one will be good to merge 👍
} | ||
// If no label source was specified, use the key name | ||
if labelSrc == nil || *labelSrc == "" { | ||
lName := labelName |
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.
I think we should keep this explicit. If folks want a label/value combination of the same value, they should define it as such.
12d3ac0
to
f6ae843
Compare
Done the changes, please have a look. |
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.
After we have this unnecessary behaviour removed, we can proceed 👍
} | ||
// If no label source was specified, use the key name | ||
if labelSrc == nil || *labelSrc == "" { | ||
lName := labelName |
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.
Please remove this @sankalp-r
f6ae843
to
206b4c2
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 a lot @sankalp-r! This is a super addition
Looks like there are some linter issues @sankalp-r. I'll merge once CI is green |
206b4c2
to
859c14c
Compare
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
859c14c
to
71dcb75
Compare
Fixed linter issue. |
It's a flaky CI job, rerunning |
Signed-off-by: Sankalp Rangare sankalprangare786@gmail.com
What this PR does / why we need it:
This PR adds a new stage in Promtail called
static_labels
to provide custom labels.Which issue(s) this PR fixes:
Fixes #4384
Special notes for your reviewer:
Checklist