-
Notifications
You must be signed in to change notification settings - Fork 187
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
Fix unnecessary loki.process
config reloads
#1426
Conversation
d57eb75
to
a509988
Compare
I'm a bit hesitant about this change as it adds a lot of code that could be considered a boilerplate and an extra maintenance burden. IIRC this is also code that we copied from |
@thampiotr thank you very much for the review!
That's true. To avoid diversion, I could make the same change in the Promtail code in the loki repo. I'm not sure if it's necessary there though. Promtail does have a config reload feature, but I'm not sure how (and if) the old config is compared with the new one.
Unfortunately, serialisation to a string doesn't work because things like secrets have custom behaviour and they'll be redacted in the final string. So if the config changes, and only a secret has changed, a config reload wouldn't happen (which would be wrong). I think the Agent has this bug in static mode. If you have other ideas I'd be happy to hear them, but this is the best I came up with. I realise it's a lot of code, I also am not a huge fan of this :/ But it's reliable. |
Good point. But maybe it's worth adding functionality to serialise with secrets or at least hash of the secrets so that we can avoid the hand-written code to do all these cloning? |
Is this more reliable than simply having |
This PR has not had any activity in the past 30 days, so the |
PR Description
When Alloy's config is reloaded, components whose config didn't change should not be reloaded. This hasn't been true for
loki.process
if certain stages are present. That's because for some stages the config struct is mutated after the pipeline is started. Notably, this is the case forstage.labels
. The solution I went with in this PR is to deep copy the config struct so that we can compare the old and new configs more reliably.PR Checklist