From 6ae1242d94fecb44836a5733486d0aa8176c518f Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 29 Jun 2021 20:34:37 -0400 Subject: [PATCH] [APM] Central config: Improve logs for debugging (#103288) (#103789) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Søren Louv-Jansen --- .../routes/settings/agent_configuration.ts | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts index b2461e381bd008..05eec478937935 100644 --- a/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration.ts @@ -206,16 +206,24 @@ const agentConfigurationSearchRoute = createApmServerRoute({ throw Boom.notFound(); } - logger.info(`Config was found for ${service.name}/${service.environment}`); - - // update `applied_by_agent` field - // when `markAsAppliedByAgent` is true (Jaeger agent doesn't have etags) - // or if etags match. - // this happens in the background and doesn't block the response - if ( + // whether to update `applied_by_agent` field + // It will be set to true of the etags match or if `markAsAppliedByAgent=true` + // `markAsAppliedByAgent=true` means "force setting it to true regardless of etag". This is needed for Jaeger agent that doesn't have etags + const willMarkAsApplied = (markAsAppliedByAgent || etag === config._source.etag) && - !config._source.applied_by_agent - ) { + !config._source.applied_by_agent; + + logger.debug( + `[Central configuration] Config was found for: + service.name = ${service.name}, + service.environment = ${service.environment}, + etag (requested) = ${etag}, + etag (existing) = ${config._source.etag}, + markAsAppliedByAgent = ${markAsAppliedByAgent}, + willMarkAsApplied = ${willMarkAsApplied}` + ); + + if (willMarkAsApplied) { markAppliedByAgent({ id: config._id, body: config._source, setup }); }