Skip to content

Commit 583260a

Browse files
authored
add infer-spans dynamoic central config handling (#838)
* add infer-spans dynamoic central config handling * enable the InferSpans config
1 parent d0df278 commit 583260a

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

custom/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ dependencies {
3737
// exclude transitive dependency as it's provided through agent packaging
3838
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk")
3939
}
40+
implementation(libs.contribInferredSpans) {
41+
// exclude transitive dependency as it's provided through agent packaging
42+
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk")
43+
exclude(group = "io.opentelemetry", module = "opentelemetry-semconv")
44+
exclude(group = "io.opentelemetry", module = "opentelemetry-sdk-extension-autoconfigure-spi")
45+
}
46+
4047
testImplementation(libs.contribSpanStacktrace)
4148

4249
// needs to be added in order to allow access to AgentListener interface

custom/src/main/java/co/elastic/otel/dynamicconfig/CentralConfig.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import co.elastic.otel.compositesampling.DynamicCompositeParentBasedTraceIdRatioBasedSampler;
2222
import co.elastic.otel.dynamicconfig.internal.OpampManager;
2323
import co.elastic.otel.logging.AgentLog;
24+
import io.opentelemetry.contrib.inferredspans.InferredSpans;
2425
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
2526
import io.opentelemetry.sdk.trace.SdkTracerProviderBuilder;
2627
import java.io.IOException;
@@ -130,6 +131,7 @@ public static class Configs {
130131
new DeactivateInstrumentations(),
131132
new LoggingLevel(),
132133
new SamplingRate(),
134+
new InferSpans(),
133135
new PollingInterval())
134136
.collect(Collectors.toMap(ConfigOption::getConfigName, option -> option));
135137
}
@@ -314,6 +316,22 @@ void update(String configurationValue, OpampManager opampManager)
314316
}
315317
}
316318

319+
public static final class InferSpans extends ConfigOption {
320+
InferSpans() {
321+
super("infer_spans", "true");
322+
}
323+
324+
@Override
325+
void update(String configurationValue, OpampManager opampManager)
326+
throws IllegalArgumentException {
327+
// TODO when setProfilerInterval() returns the old value, use that for 'true'
328+
InferredSpans.setProfilerInterval(
329+
configurationValue.equals("true")
330+
? Duration.ofSeconds(5)
331+
: Duration.ofSeconds(Integer.MAX_VALUE));
332+
}
333+
}
334+
317335
public static final class PollingInterval extends ConfigOption {
318336
PollingInterval() {
319337
super("opamp_polling_interval", "30s");

custom/src/main/java/co/elastic/otel/dynamicconfig/internal/OpampManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import com.dslplatform.json.DslJson;
2222
import com.dslplatform.json.JsonReader;
2323
import com.dslplatform.json.MapConverter;
24-
import io.opentelemetry.opamp.client.internal.OpampClient;
25-
import io.opentelemetry.opamp.client.internal.OpampClientBuilder;
24+
import io.opentelemetry.opamp.client.OpampClient;
25+
import io.opentelemetry.opamp.client.OpampClientBuilder;
2626
import io.opentelemetry.opamp.client.internal.connectivity.http.OkHttpSender;
2727
import io.opentelemetry.opamp.client.internal.request.delay.PeriodicDelay;
2828
import io.opentelemetry.opamp.client.internal.request.delay.RetryPeriodicDelay;

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ opentelemetryJavaagentAlpha = "2.20.1-alpha"
1515

1616
# otel contrib
1717
# updated from upstream agent with gradle/update-upstream.sh
18-
opentelemetryContribAlpha = "1.49.0-alpha"
18+
opentelemetryContribAlpha = "1.50.0-alpha"
1919

2020
# otel semconv
2121
# updated from upstream agent with gradle/update-upstream.sh

0 commit comments

Comments
 (0)