fixes jaeger remote sampler service strategies bug (#5418)
This commit is contained in:
parent
23c5516252
commit
4af30515a4
|
|
@ -17,7 +17,7 @@ public class JaegerRemoteSamplerProvider implements ConfigurableSamplerProvider
|
|||
static final String ATTRIBUTE_PROPERTY = "otel.resource.attributes";
|
||||
static final String SERVICE_NAME_PROPERTY = "otel.service.name";
|
||||
static final String SAMPLER_ARG_PROPERTY = "otel.traces.sampler.arg";
|
||||
|
||||
static final String RESOURCE_ATTRIBUTE_SERVICE_NAME_PROPERTY = "service.name";
|
||||
private static final String ENDPOINT_KEY = "endpoint";
|
||||
private static final String POLLING_INTERVAL = "pollingInterval";
|
||||
private static final String INITIAL_SAMPLING_RATE = "initialSamplingRate";
|
||||
|
|
@ -29,7 +29,7 @@ public class JaegerRemoteSamplerProvider implements ConfigurableSamplerProvider
|
|||
String serviceName = config.getString(SERVICE_NAME_PROPERTY);
|
||||
if (serviceName == null) {
|
||||
Map<String, String> resourceAttributes = config.getMap(ATTRIBUTE_PROPERTY);
|
||||
serviceName = resourceAttributes.get(SERVICE_NAME_PROPERTY);
|
||||
serviceName = resourceAttributes.get(RESOURCE_ATTRIBUTE_SERVICE_NAME_PROPERTY);
|
||||
}
|
||||
if (serviceName != null) {
|
||||
builder.setServiceName(serviceName);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ public class JaegerRemoteSamplerProviderTest {
|
|||
void serviceNameInAttributeProperties() {
|
||||
ConfigProperties mockConfig = mock(ConfigProperties.class);
|
||||
HashMap<String, String> attributeProperties = new HashMap<>();
|
||||
attributeProperties.put(JaegerRemoteSamplerProvider.SERVICE_NAME_PROPERTY, "test_service2");
|
||||
attributeProperties.put(
|
||||
JaegerRemoteSamplerProvider.RESOURCE_ATTRIBUTE_SERVICE_NAME_PROPERTY, "test_service2");
|
||||
when(mockConfig.getMap(JaegerRemoteSamplerProvider.ATTRIBUTE_PROPERTY))
|
||||
.thenReturn(attributeProperties);
|
||||
ServiceLoader<ConfigurableSamplerProvider> samplerProviders =
|
||||
|
|
|
|||
Loading…
Reference in New Issue