-
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
Lambda-promtail: Enhance lambda-promtail to support adding extra labels from an environment variable value #5359
Conversation
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 it would make more sense to just load the env var as a comma separated list of label name and value, such as name1,value1,name2,value2
. Then just split on each ,
and if the len is not divisible by 2 then we panic with a message that the env var is invalid.
…in the form of "name1,value1,name2,value2,..."
) | ||
|
||
func init() { | ||
func configure() { |
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 am not super familiar with Go, but having this as init()
was making it impossible to run the tests. I renamed to configure()
and call it from main()
let me know if that is a problem.
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.
Lets name this something a bit more descriptive like setupArguments
. Here's a description of what the init function is: https://go.dev/doc/effective_go#init
) | ||
|
||
func init() { | ||
func configure() { |
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.
Lets name this something a bit more descriptive like setupArguments
. Here's a description of what the init function is: https://go.dev/doc/effective_go#init
…y extra labels code to utility method, replaced hardcoded string with const global var in module.
The |
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, one more comment that should be addressed IMO
@cstyan any way for me to retry the CI without committing anything? It failed on clone for Docker-amd64 which doesn't really have anything to do with this PR. |
@JBSchami reran the tests and it looks like everything's good. One last thing, could you add a short example to |
…use extra labels.
What this PR does / why we need it:
This PR gives users of lambda-promtail the ability to add extra labels to logs forwarded from both S3 and Cloudwatch sources.
Which issue(s) this PR fixes:
Fixes #5356
Special notes for your reviewer:
Checklist
CHANGELOG.md
about the changes.