Skip to content
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(loki/src/k8s): configurable default instance label for scraped pod logs #6739

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hainenber
Copy link
Contributor

PR Description

Which issue(s) this PR fixes

Fixes grafana/alloy#211

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Mar 22, 2024
Copy link
Contributor

@clayton-cornell clayton-cornell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some doc input/comments

@clayton-cornell clayton-cornell requested a review from a team March 22, 2024 20:24
@clayton-cornell
Copy link
Contributor

Over to @grafana/grafana-agent-maintainers for a code review.

Copy link
Contributor

@clayton-cornell clayton-cornell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved from a docs standpoint


Name | Type | Description | Default | Required
------------------------ | ------------------- | ------------------------------------------------------------- | ------- | --------
`enabled` | `bool` | Enable setting default instance label value. | true | no
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a separate enabled value? Would having a value inherently make it true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would an empty string indicate of no default instance label for every podlogs or having an empty default instance label?

I'm not sure if having a separate value is the way to go here but I feel like its explicitness would help.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK in both Prometheus and Loki, an empty value label is considered equivalent to a label that doesn't exist.

So in this case, you wouldn't really be able to have an empty instance label. I'd agree this makes sense as an attribute instead of a block. It should only override defaultInstance when it's expliticly supplied as a non-empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool knowing the practice put in place by other parts of the ecosystem :D

I'd try implementing it that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that the original requester would like to disable the behavior of setting default instance label too 🤦

And having an empty string to disable the behavior would be breaking change, unless we choose a token to signify the act of disabling, like defaultInstanceLabel="disabled" or something, which doesn't seem right to me 🤔

To have both the ability to disable the behavior and to set a custom default instance label, I think we gotta resort to block now (unless having a separate attribute :D)

… pod logs

Signed-off-by: hainenber <dotronghai96@gmail.com>
… actual value

Signed-off-by: hainenber <dotronghai96@gmail.com>
@hainenber hainenber force-pushed the configurable-default-instance-label-for-scraped-k8s-logs branch from 3281751 to 375f654 Compare April 6, 2024 14:27
@rfratto rfratto added the variant/flow Relatd to Grafana Agent Flow. label Apr 9, 2024
Copy link
Contributor

This PR has not had any activity in the past 30 days, so the needs-attention label has been added to it.
If you do not have enough time to follow up on this PR or you think it's no longer relevant, consider closing it.
The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your PR will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!

@github-actions github-actions bot added the needs-attention An issue or PR has been sitting around and needs attention. label May 11, 2024
@github-actions github-actions bot removed the needs-attention An issue or PR has been sitting around and needs attention. label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Docs Squad label across all Grafana Labs repos variant/flow Relatd to Grafana Agent Flow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

loki.source.kubernetes instance label conflicts with self defined instance labels
5 participants