Skip to content

Commit

Permalink
[APM] Central config: Improve logs for debugging (#103288) (#103789)
Browse files Browse the repository at this point in the history
Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
  • Loading branch information
kibanamachine and sorenlouv authored Jun 30, 2021
1 parent 2b893e1 commit 6ae1242
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions x-pack/plugins/apm/server/routes/settings/agent_configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand Down

0 comments on commit 6ae1242

Please sign in to comment.