From 83b0e365d00936e7cc4ecbd35cc5b64dfef7a3d1 Mon Sep 17 00:00:00 2001 From: Jonas Kunz Date: Fri, 13 Oct 2023 13:38:11 +0200 Subject: [PATCH] Minor fixes, updated docs and changelog --- CHANGELOG.asciidoc | 4 ++++ .../java/co/elastic/apm/agent/impl/ElasticApmTracer.java | 2 +- .../co/elastic/apm/agent/impl/TracerConfiguration.java | 3 ++- .../co/elastic/apm/agent/impl/ElasticApmTracerTest.java | 2 +- .../apm/agent/micrometer/MicrometerMetricsReporter.java | 8 +++----- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index f5c09b6aa5..bd58d283fc 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,10 @@ Use subheadings with the "=====" level for adding notes for unreleased changes: === Unreleased +[float] +===== Features +* Context propagation and log correlation now takes place even if recording is disabled - {pull}3358[#3358] + [float] ===== Bug fixes * Fixed too many spans being created for `HTTPUrlConnection` requests with method `HEAD` - {pull}3353[#3353] diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java index 1d03e8b92e..93cf7dd3f3 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/ElasticApmTracer.java @@ -391,7 +391,7 @@ public Span startSpan(AbstractSpan parent, Baggage baggage, long epochMicros) public RemoteParentContext createRemoteParentContext() { RemoteParentContext ctx = remoteParentContextPool.createInstance(); while (ctx.getReferenceCount() != 0) { - logger.warn("Tried to start a span with a non-zero reference count {} {}", ctx.getReferenceCount(), ctx); + logger.warn("Tried to start a remote-context with a non-zero reference count {} {}", ctx.getReferenceCount(), ctx); ctx = remoteParentContextPool.createInstance(); } return ctx; diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java index 2c4cbb25fc..3531a8a6e0 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/impl/TracerConfiguration.java @@ -35,8 +35,9 @@ public class TracerConfiguration extends ConfigurationOptionProvider { "\n" + "A boolean specifying if the agent should be recording or not.\n" + "When recording, the agent instruments incoming HTTP requests, tracks errors and collects and sends metrics.\n" + - "When not recording, the agent works as a noop, not collecting data and not communicating with the APM sever,\n" + + "When not recording, the agent works almost as a noop, not collecting data and not communicating with the APM sever,\n" + "except for polling the central configuration endpoint.\n" + + "Note that trace context propagation, baggage and log correlation remain active even when recording is disabled.\n"+ "As this is a reversible switch, agent threads are not being killed when inactivated, but they will be \n" + "mostly idle in this state, so the overhead should be negligible.\n" + "\n" + diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java index 2355ea324a..979944eea4 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/impl/ElasticApmTracerTest.java @@ -755,7 +755,7 @@ public AbstractSpan getSpan() { return null; } - @org.jetbrains.annotations.Nullable + @Nullable @Override public TraceContext getRemoteParent() { return null; diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java index 59eca46dbd..3379ce66cd 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/main/java/co/elastic/apm/agent/micrometer/MicrometerMetricsReporter.java @@ -188,11 +188,9 @@ void run(final long now) { for (MeterRegistry registry : currentlyReportableRegistries) { registry.forEachMeter(meterConsumer); } - if(tracer.isRunning()) { - logger.debug("Reporting {} meters", meterConsumer.meters.size()); - for (JsonWriter serializedMetricSet : serializer.serialize(meterConsumer.meters, now * 1000)) { - reporter.reportMetrics(serializedMetricSet); - } + logger.debug("Reporting {} meters", meterConsumer.meters.size()); + for (JsonWriter serializedMetricSet : serializer.serialize(meterConsumer.meters, now * 1000)) { + reporter.reportMetrics(serializedMetricSet); } }