-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove ManagerV2 unnecessary reload when apm tracing config is nil #41794
base: main
Are you sure you want to change the base?
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
@@ -112,6 +112,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] | |||
- Ensure Elasticsearch output can always recover from network errors {pull}40794[40794] | |||
- Add `translate_ldap_attribute` processor. {pull}41472[41472] | |||
- Remove unnecessary debug logs during idle connection teardown {issue}40824[40824] | |||
- Remove unnecessary reload for Elastic Agent managed beats when apm tracing config changes from nil to nil {pull}41794[41794] |
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.
[To reviewer] Is this an accurate description? Is this the right place to put the changelog if it is backported to 8.16 and 8.17?
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
@@ -893,6 +893,13 @@ func (cm *BeatV2Manager) reloadAPM(unit *agentUnit) { | |||
apmConfig = expected.APMConfig | |||
} | |||
} | |||
|
|||
if (cm.lastAPMCfg == nil && apmConfig == nil) || (cm.lastAPMCfg != nil && gproto.Equal(cm.lastAPMCfg, apmConfig)) { |
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.
[To reviewer] With this change, apm.Reload(nil)
is never called if apmConfig is always nil, even when starting the beat. I assume that is fine.
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.
Skipping the apm.Reload(nil)
would potentially skip setting the initial configuration to an empty one to disable tracing. The implementation of this is on the APM server side. https://github.com/elastic/apm-server/blob/840fe6c8cb328bbb07ce49c21d6a3068be64d9e4/internal/beatcmd/reloader.go#L213-L227
This depends on what the default state is, or if it would ever change. If the default state is that APM tracing is disabled the initial apm.Reload(nil)
has no effect. If it isn't disabled then skipping it has a consequence.
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.
LGTM under the assumption that skipping an initial nil reload of the APM configuration is fine.
Proposed commit message
Remove unnecessary reload due to apm tracing config change in ManagerV2 when apm tracing config changes from nil to nil.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Trigger input unit config change. With this PR, there should be no
Reloading APM tracing
logged when reloading.Related issues
Use cases
Screenshots
Logs