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

Fix issue with unnecessary config reload in static mode #6977

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

ptodev
Copy link
Contributor

@ptodev ptodev commented Jul 9, 2024

PR Description

When a config reload is triggered, the config shouldn't be reloaded if it hasn't changed. Unfortunately, there was a bug which prevented this for the "metrics" and "logs" subsystems:

  • The X-Agent-Id header isn't in the user-defined config.
  • In the "logs" subsytem, the scrape_configs/static_configs section, there might be a targets: [localhost] which was added by default by Promtail because the user didn't set it explicitly

For example, when using static_mode.yaml.txt, the Agent tries interprets the new config as example_incoming.yaml.txt. This doesn't match the way it thinks the "current" config that it uses is defined(example_running.yaml.txt), so it does a config reload. This issue is not present in Flow - it's only in static mode.

There might also be similar issues that cause mismatch in configs. It's possible that I don't see all such issues, since my config file is using very few functionality. The only sure way of eliminating these issues that I can think of is to store the incoming config in a string, as this PR is doing.

Notes to the Reviewer

This is a prerequisite for #6971

PR Checklist

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

static/metrics/agent.go Outdated Show resolved Hide resolved
static/metrics/agent.go Outdated Show resolved Hide resolved
@ptodev ptodev merged commit 8dbd241 into main Jul 11, 2024
10 checks passed
@ptodev ptodev deleted the ptodev/fix-unnecessary-reload branch July 11, 2024 11:51
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Aug 11, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants