Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package co.elastic.otel;

import co.elastic.otel.compositesampling.DynamicCompositeParentBasedTraceIdRatioBasedSampler;
import co.elastic.otel.dynamicconfig.BlockableLogRecordExporter;
import co.elastic.otel.dynamicconfig.BlockableMetricExporter;
import co.elastic.otel.dynamicconfig.BlockableSpanExporter;
Expand Down Expand Up @@ -91,6 +92,7 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) {
(providerBuilder, properties) -> {
CentralConfig.init(providerBuilder, properties);
AgentLog.addSpanLoggingIfRequired(providerBuilder, properties);
providerBuilder.setSampler(DynamicCompositeParentBasedTraceIdRatioBasedSampler.INSTANCE);
return providerBuilder;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package co.elastic.otel.dynamicconfig;

import co.elastic.otel.compositesampling.DynamicCompositeParentBasedTraceIdRatioBasedSampler;
import co.elastic.otel.dynamicconfig.internal.OpampManager;
import co.elastic.otel.logging.AgentLog;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
Expand Down Expand Up @@ -128,6 +129,7 @@ public static class Configs {
new DeactivateAllInstrumentations(),
new DeactivateInstrumentations(),
new LoggingLevel(),
new SamplingRate(),
new PollingInterval())
.collect(Collectors.toMap(ConfigOption::getConfigName, option -> option));
}
Expand Down Expand Up @@ -299,6 +301,19 @@ void update(String configurationValue, OpampManager opampManager)
}
}

public static final class SamplingRate extends ConfigOption {
SamplingRate() {
super("sampling_rate", "1.0");
}

@Override
void update(String configurationValue, OpampManager opampManager)
throws IllegalArgumentException {
DynamicCompositeParentBasedTraceIdRatioBasedSampler.setRatio(
Double.parseDouble(configurationValue));
}
}

public static final class PollingInterval extends ConfigOption {
PollingInterval() {
super("opamp_polling_interval", "30s");
Expand Down
Loading