-
Notifications
You must be signed in to change notification settings - Fork 524
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
Consume APM configuration over the elastic-agent control protocol #11381
Comments
elastic/elastic-agent#2612 has been merged; moving to |
It seems beats is already using the agent control protocol under the hood (#12508 (comment)) so we can't add an additional client. We can either stop using the beats manager and implement the feature in apm-server or try to work with beats (I'm not sure if this is possible since beats is hardcoding the values passed to the control protocol). Another issue is that some of the libraries we use hardcode the tracer (e.g. go-docappender) so we can only stop and recreate the indexer or implement an option to retrieve the indexer dynamically. Any feedback, opinion or alternative solution ? |
Could we update libbeat to consume the
We already hot-reload everything on config changes, so if we do the above then we can construct a new tracer with the new config. |
@joshdover @cmacknz does my suggest above (to consume TriggeredAPMChange, update the beat config, and trigger a reload) sound sensible? How do you intend to deal with TriggeredAPMChange for Beats? I think this should probably be solved in libbeat, and then apm-server can consume updates from there. Is that something the control plane team can take on? |
Taking a closer look at this, the APM configuration is being received in libbeat but it is not exposed in any way. The APMConfig we need is attached to each unit that may have changed already as part of the expected state, we just don't do anything with it. // Expected contains the expected state, log level, features and config for a unit.
type Expected struct {
Config *proto.UnitExpectedConfig
Features *proto.Features
LogLevel UnitLogLevel
State UnitState
APMConfig *proto.APMConfig
} Here it is in our management code at the point where we reload the Beat configurations. for _, unit := range units {
expected := unit.Expected() The question I have is what we should do with the APM configuration at this point? In what form can APM server actually use it? Our agent client is quite isolated from the rest of Beats, so at the point where we receive the APM configuration we could change a Beat global tracing configuration or add a way to watch changes to it externally. With respect to switch change.Type {
// Within the context of how we send config to beats, I'm not sure if there is a difference between
// A unit add and a unit change, since either way we can't do much more than call the reloader
case client.UnitChangedAdded:
cm.addUnit(change.Unit)
// reset can be called here because `<-t.C` is handled in the same select
t.Reset(cm.changeDebounce)
case client.UnitChangedModified:
cm.modifyUnit(change.Unit)
// reset can be called here because `<-t.C` is handled in the same select
t.Reset(cm.changeDebounce) This Beat management code was originally written before the change triggers existed so it doesn't make use of them yet. |
What do you think about introducing a new In APM Server we would update apm-server/internal/beatcmd/reloader.go Lines 68 to 73 in 17969f9
|
Moving this out of |
Hooking into the existing libbeat configuration reload API makes sense to me as a way to expose this. Our team could do this, answering when we could do it I'll have to leave with @pierrehilbert. |
@pierrehilbert could you please provide an update when this could be done by the Elastic Agent team? We are eager of enabling apm tracing when in managed mode. |
@pierrehilbert any update on this please? We are really eager to finally get this in. |
Really sorry @simitt I missed the first mentions. |
Not certain if the question is directed towards @pchila or me, but from our end, the sooner the better. If you can aim for providing functionality in |
Created elastic/beats#39606 to summarize the discussion between @cmacknz and @axw and track this request in the Ingest team's roadmap. |
I have PR elastic/beats#40030 up for review. You can start with that PR as a base until it is merged, to implement the feature you need in APM server. If you have any questions just let me know and I can help. |
I've done the manual testing by running the APM Server in managed mode with locally built Elastic Agent image and left the result in the comment. |
@kyungeunni please ensure with your testing that the self instrumentation can be used in the ESS setup. That is the main use case for us to be able to leverage apm self instrumentation when troubleshooting SDHs. |
I'll test this in ESS. Just sharing some notes: Fleet-server uses the same APMConfig and seems to have the tracing enabled on their side, not relying on The configs used to make the tracing work on
In the current state, we will be able to send the tracing based on what I've tested locally, but we won't be able to set the Global Labels so we need extra work on this part. I see three options to support global labels:
1 is quick and short, but it's not declarative and a bit hacky. if we choose to go with 2 or 3, we will be able to parse and support more config values coming from APMConfig (e.g. TLS) |
If (3) is feasible without significantly more effort, then I would be in favour of that, to reduce our dependency on libbeat. |
Required follow up tasks to make this fully work are created and assigned: |
Validated as a part of #13604 |
In order to enable APM tracing when APM Server is managed by Elastic Agent, APM Server needs to apply APM configuration settings when they're passed over the control protocol. This is necessary to enable tracing of APM Server in ESS and ECE.
These settings should be used to enable APM Server's self tracing functionality, and send the traces to the configured APM Server passed via the control protocol This may require that we change how the
apm.Tracer
object is created and passed to internal objects as the config may change during runtime.References:
The text was updated successfully, but these errors were encountered: