|
21 | 21 | import co.elastic.otel.compositesampling.DynamicCompositeParentBasedTraceIdRatioBasedSampler; |
22 | 22 | import co.elastic.otel.dynamicconfig.internal.OpampManager; |
23 | 23 | import co.elastic.otel.logging.AgentLog; |
| 24 | +import io.opentelemetry.contrib.inferredspans.InferredSpans; |
24 | 25 | import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; |
25 | 26 | import io.opentelemetry.sdk.trace.SdkTracerProviderBuilder; |
26 | 27 | import java.io.IOException; |
@@ -130,6 +131,7 @@ public static class Configs { |
130 | 131 | new DeactivateInstrumentations(), |
131 | 132 | new LoggingLevel(), |
132 | 133 | new SamplingRate(), |
| 134 | + new InferSpans(), |
133 | 135 | new PollingInterval()) |
134 | 136 | .collect(Collectors.toMap(ConfigOption::getConfigName, option -> option)); |
135 | 137 | } |
@@ -314,6 +316,22 @@ void update(String configurationValue, OpampManager opampManager) |
314 | 316 | } |
315 | 317 | } |
316 | 318 |
|
| 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 | + |
317 | 335 | public static final class PollingInterval extends ConfigOption { |
318 | 336 | PollingInterval() { |
319 | 337 | super("opamp_polling_interval", "30s"); |
|
0 commit comments