io.opentelemetry.contrib.awsxray.AwsXrayRemoteSamplerProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-aws-xray Show documentation
Show all versions of opentelemetry-aws-xray Show documentation
OpenTelemetry AWS X-Ray Support
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.contrib.awsxray;
import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer;
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.trace.samplers.Sampler;
import java.util.Map;
@AutoService(ConfigurableSamplerProvider.class)
public class AwsXrayRemoteSamplerProvider implements ConfigurableSamplerProvider {
@Override
public Sampler createSampler(ConfigProperties config) {
Resource resource = io.opentelemetry.contrib.awsxray.ResourceHolder.getResource();
AwsXrayRemoteSamplerBuilder builder = AwsXrayRemoteSampler.newBuilder(resource);
Map params = config.getMap("otel.traces.sampler.arg");
String endpoint = params.get("endpoint");
if (endpoint != null) {
builder.setEndpoint(endpoint);
}
return builder.build();
}
@Override
public String getName() {
return "xray";
}
/** Deprecated in favor of {@link io.opentelemetry.contrib.awsxray.ResourceHolder}. */
@Deprecated
@AutoService(AutoConfigurationCustomizerProvider.class)
public static final class ResourceHolder implements AutoConfigurationCustomizerProvider {
@Deprecated
@Override
public void customize(AutoConfigurationCustomizer autoConfiguration) {
// No-op
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy