Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump io.micrometer:micrometer-tracing-bom from 1.1.6 to 1.2.0 #13397

Merged
merged 1 commit into from
Nov 25, 2023
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
2 changes: 1 addition & 1 deletion dubbo-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<envoy_api_version>0.1.35</envoy_api_version>
<micrometer.version>1.12.0</micrometer.version>

<micrometer-tracing.version>1.1.6</micrometer-tracing.version>
<micrometer-tracing.version>1.2.0</micrometer-tracing.version>
<t_digest.version>3.3</t_digest.version>
<prometheus_client.version>0.16.0</prometheus_client.version>
<reactive.version>1.0.4</reactive.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.dubbo.spring.boot.observability.autoconfigure.otel;

import org.apache.dubbo.common.Version;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.rpc.model.ModuleModel;
import org.apache.dubbo.spring.boot.autoconfigure.DubboConfigurationProperties;
Expand All @@ -28,6 +29,7 @@
import java.util.List;
import java.util.stream.Collectors;

import io.opentelemetry.api.common.AttributeKey;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand Down Expand Up @@ -93,13 +95,29 @@ io.opentelemetry.sdk.trace.SdkTracerProvider otelSdkTracerProvider(
.getApplication()
.map(ApplicationConfig::getName)
.orElse(DEFAULT_APPLICATION_NAME);
// Due to https://github.com/micrometer-metrics/tracing/issues/343
String RESOURCE_ATTRIBUTES_CLASS_NAME = "io.opentelemetry.semconv.ResourceAttributes";
boolean isLowVersion = !ClassUtils.isPresent(
RESOURCE_ATTRIBUTES_CLASS_NAME, Thread.currentThread().getContextClassLoader());
AttributeKey<String> serviceNameAttributeKey = AttributeKey.stringKey("service.name");
String SERVICE_NAME = "SERVICE_NAME";

if (isLowVersion) {
RESOURCE_ATTRIBUTES_CLASS_NAME = "io.opentelemetry.semconv.resource.attributes.ResourceAttributes";
}
try {
serviceNameAttributeKey = (AttributeKey<String>) ClassUtils.resolveClass(
RESOURCE_ATTRIBUTES_CLASS_NAME,
Thread.currentThread().getContextClassLoader())
.getDeclaredField(SERVICE_NAME)
.get(null);
} catch (Throwable ignored) {
}
io.opentelemetry.sdk.trace.SdkTracerProviderBuilder builder =
io.opentelemetry.sdk.trace.SdkTracerProvider.builder()
.setSampler(sampler)
.setResource(io.opentelemetry.sdk.resources.Resource.create(
io.opentelemetry.api.common.Attributes.of(
io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_NAME,
applicationName)));
io.opentelemetry.api.common.Attributes.of(serviceNameAttributeKey, applicationName)));
spanProcessors.orderedStream().forEach(builder::addSpanProcessor);
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<properties>
<micrometer.version>1.12.0</micrometer.version>
<micrometer-tracing.version>1.1.6</micrometer-tracing.version>
<micrometer-tracing.version>1.2.0</micrometer-tracing.version>
<opentelemetry.version>1.32.0</opentelemetry.version>
<zipkin-reporter.version>2.16.4</zipkin-reporter.version>
<prometheus-client.version>0.16.0</prometheus-client.version>
Expand Down
Loading