-
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
Add APM trace configuration to V2AgentManager #40030
Conversation
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
@@ -865,6 +873,65 @@ func (cm *BeatV2Manager) reloadInputs(inputUnits []*agentUnit) error { | |||
return nil | |||
} | |||
|
|||
// reloadAPM reload APM tracing, it returns a bool and an error. | |||
// The bool, if set, indicates that the output reload requires an restart, | |||
// in that case the error is always `nil`. |
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.
Comment seems out of date? reloadAPM
doesn't return anything.
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.
Copy-and-paste error, will fix.
@@ -669,6 +673,10 @@ func (cm *BeatV2Manager) reload(units map[unitKey]*agentUnit) { | |||
cm.logger.Errorw("setting output state", "error", err) | |||
} | |||
|
|||
// reload APM tracing configuration | |||
// all error handling is handled inside of reloadAPM |
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.
Both reloadInputs
and reloadOutput
return an error, why does reloadAPM
not?
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.
Because in no case, do we want APM trace configuration to cause the beat to fail. I don't think we want that, so I handle all of that logic internally inside of reloadAPM
.
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 updated the docstring on reloadAPM
to provide this reasoning.
cm.logger.Debug("Reloading APM tracing") | ||
err = apm.Reload(reloadConfig) | ||
if err != nil { | ||
cm.logger.Debugf("Error reloading APM tracing: %s", err) |
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.
nit: shouldn't this be logged as an error, similar to line 918?
Proposed commit message
Added a
APM
toreload.Registry
.Adds the
APM
to thereload.Registry
to allow a reloadable configurator to be set and automatically haveReload
called when an APM trace configuration is sent over the Elastic Agent V2 control protocol.Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added an entry in(no changelog as currently not user facing)CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
None.
Related issues
apm
reloaders when the config has changed #39606