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

Move observability autoconfigure to dubbo-spring-boot-autoconfigure #14705

Merged
merged 4 commits into from
Sep 29, 2024
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
1 change: 0 additions & 1 deletion .artifacts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ dubbo-spring-boot-3-autoconfigure
dubbo-spring-boot-autoconfigure-compatible
dubbo-spring-boot-compatible
dubbo-observability-spring-boot-starters
dubbo-observability-spring-boot-autoconfigure
dubbo-tracing-brave-zipkin-spring-boot-starter
dubbo-tracing-otel-zipkin-spring-boot-starter
dubbo-tracing-otel-otlp-spring-boot-starter
Expand Down
5 changes: 0 additions & 5 deletions dubbo-distribution/dubbo-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,6 @@
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-observability-spring-boot-autoconfigure</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-tracing-otel-zipkin-spring-boot-starter</artifactId>
Expand Down
105 changes: 105 additions & 0 deletions dubbo-spring-boot/dubbo-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,111 @@
<scope>provided</scope>
</dependency>

<!-- micrometer -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus-simpleclient</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.tdunning</groupId>
<artifactId>t-digest</artifactId>
<scope>provided</scope>
</dependency>

<!-- prometheus client -->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<optional>true</optional>
</dependency>

<!-- bridge -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
<optional>true</optional>
</dependency>

<!-- exporter -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-zipkin</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
<optional>true</optional>
</dependency>

<!-- sender -->
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-urlconnection</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-qos</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-config-spring</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure;
package org.apache.dubbo.spring.boot.autoconfigure.observability;

import org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration;
import org.apache.dubbo.spring.boot.observability.autoconfigure.annotation.ConditionalOnDubboTracingEnable;
import org.apache.dubbo.spring.boot.autoconfigure.observability.annotation.ConditionalOnDubboTracingEnable;
import org.apache.dubbo.tracing.handler.DubboClientTracingObservationHandler;
import org.apache.dubbo.tracing.handler.DubboServerTracingObservationHandler;

import io.micrometer.tracing.Tracer;
import io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler;
import io.micrometer.tracing.handler.PropagatingSenderTracingObservationHandler;
import io.micrometer.tracing.propagation.Propagator;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand Down Expand Up @@ -72,20 +76,18 @@ public io.micrometer.tracing.handler.DefaultTracingObservationHandler defaultTra
@ConditionalOnMissingBean
@ConditionalOnBean({io.micrometer.tracing.Tracer.class, io.micrometer.tracing.propagation.Propagator.class})
@Order(SENDER_TRACING_OBSERVATION_HANDLER_ORDER)
public io.micrometer.tracing.handler.PropagatingSenderTracingObservationHandler<?>
propagatingSenderTracingObservationHandler(
io.micrometer.tracing.Tracer tracer, io.micrometer.tracing.propagation.Propagator propagator) {
return new io.micrometer.tracing.handler.PropagatingSenderTracingObservationHandler<>(tracer, propagator);
public PropagatingSenderTracingObservationHandler<?> propagatingSenderTracingObservationHandler(
Tracer tracer, Propagator propagator) {
return new PropagatingSenderTracingObservationHandler<>(tracer, propagator);
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnBean({io.micrometer.tracing.Tracer.class, io.micrometer.tracing.propagation.Propagator.class})
@Order(RECEIVER_TRACING_OBSERVATION_HANDLER_ORDER)
public io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler<?>
propagatingReceiverTracingObservationHandler(
io.micrometer.tracing.Tracer tracer, io.micrometer.tracing.propagation.Propagator propagator) {
return new io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler<>(tracer, propagator);
public PropagatingReceiverTracingObservationHandler<?> propagatingReceiverTracingObservationHandler(
Tracer tracer, Propagator propagator) {
return new PropagatingReceiverTracingObservationHandler<>(tracer, propagator);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure;
package org.apache.dubbo.spring.boot.autoconfigure.observability;

import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.config.spring.context.event.DubboConfigInitEvent;
import org.apache.dubbo.qos.protocol.QosProtocolWrapper;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.spring.boot.observability.autoconfigure.annotation.ConditionalOnDubboTracingEnable;
import org.apache.dubbo.spring.boot.autoconfigure.observability.annotation.ConditionalOnDubboTracingEnable;

import java.util.Arrays;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.observation.DefaultMeterObservationHandler;
import io.micrometer.core.instrument.observation.MeterObservationHandler;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;
import io.micrometer.tracing.handler.TracingAwareMeterObservationHandler;
import io.micrometer.tracing.handler.TracingObservationHandler;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
Expand Down Expand Up @@ -69,8 +75,8 @@ public DubboObservationAutoConfiguration(ApplicationModel applicationModel) {
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(name = "io.micrometer.observation.ObservationRegistry")
io.micrometer.observation.ObservationRegistry observationRegistry() {
return io.micrometer.observation.ObservationRegistry.create();
ObservationRegistry observationRegistry() {
return ObservationRegistry.create();
}

@Bean
Expand Down Expand Up @@ -118,8 +124,7 @@ static class OnlyMetricsConfiguration {
@Bean
@ConditionalOnClass(name = "io.micrometer.core.instrument.observation.MeterObservationHandler")
ObservationHandlerGrouping metricsObservationHandlerGrouping() {
return new ObservationHandlerGrouping(
io.micrometer.core.instrument.observation.MeterObservationHandler.class);
return new ObservationHandlerGrouping(MeterObservationHandler.class);
}
}

Expand All @@ -133,7 +138,7 @@ static class OnlyTracingConfiguration {
@Bean
@ConditionalOnClass(name = "io.micrometer.tracing.handler.TracingObservationHandler")
ObservationHandlerGrouping tracingObservationHandlerGrouping() {
return new ObservationHandlerGrouping(io.micrometer.tracing.handler.TracingObservationHandler.class);
return new ObservationHandlerGrouping(TracingObservationHandler.class);
}
}

Expand All @@ -150,15 +155,14 @@ static class MetricsWithTracingConfiguration {
"io.micrometer.core.instrument.observation.MeterObservationHandler"
})
ObservationHandlerGrouping metricsAndTracingObservationHandlerGrouping() {
return new ObservationHandlerGrouping(Arrays.asList(
io.micrometer.tracing.handler.TracingObservationHandler.class,
io.micrometer.core.instrument.observation.MeterObservationHandler.class));
return new ObservationHandlerGrouping(
Arrays.asList(TracingObservationHandler.class, MeterObservationHandler.class));
}
}

@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(MeterRegistry.class)
@ConditionalOnMissingBean(io.micrometer.core.instrument.observation.MeterObservationHandler.class)
@ConditionalOnMissingBean(MeterObservationHandler.class)
static class MeterObservationHandlerConfiguration {

@ConditionalOnMissingBean(type = "io.micrometer.tracing.Tracer")
Expand All @@ -167,9 +171,8 @@ static class OnlyMetricsMeterObservationHandlerConfiguration {

@Bean
@ConditionalOnClass(name = {"io.micrometer.core.instrument.observation.DefaultMeterObservationHandler"})
io.micrometer.core.instrument.observation.DefaultMeterObservationHandler defaultMeterObservationHandler(
MeterRegistry meterRegistry) {
return new io.micrometer.core.instrument.observation.DefaultMeterObservationHandler(meterRegistry);
DefaultMeterObservationHandler defaultMeterObservationHandler(MeterRegistry meterRegistry) {
return new DefaultMeterObservationHandler(meterRegistry);
}
}

Expand All @@ -183,13 +186,10 @@ static class TracingAndMetricsObservationHandlerConfiguration {
"io.micrometer.tracing.handler.TracingAwareMeterObservationHandler",
"io.micrometer.tracing.Tracer"
})
io.micrometer.tracing.handler.TracingAwareMeterObservationHandler<
io.micrometer.observation.Observation.Context>
tracingAwareMeterObservationHandler(
MeterRegistry meterRegistry, io.micrometer.tracing.Tracer tracer) {
io.micrometer.core.instrument.observation.DefaultMeterObservationHandler delegate =
new io.micrometer.core.instrument.observation.DefaultMeterObservationHandler(meterRegistry);
return new io.micrometer.tracing.handler.TracingAwareMeterObservationHandler<>(delegate, tracer);
TracingAwareMeterObservationHandler<Observation.Context> tracingAwareMeterObservationHandler(
MeterRegistry meterRegistry, io.micrometer.tracing.Tracer tracer) {
DefaultMeterObservationHandler delegate = new DefaultMeterObservationHandler(meterRegistry);
return new TracingAwareMeterObservationHandler<>(delegate, tracer);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure;
package org.apache.dubbo.spring.boot.autoconfigure.observability;

import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_PREFIX;
import static org.apache.dubbo.spring.boot.util.DubboUtils.PROPERTY_NAME_SEPARATOR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure;
package org.apache.dubbo.spring.boot.autoconfigure.observability;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure;
package org.apache.dubbo.spring.boot.autoconfigure.observability;

import java.util.List;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure.annotation;
package org.apache.dubbo.spring.boot.autoconfigure.observability.annotation;

import org.apache.dubbo.spring.boot.observability.autoconfigure.ObservabilityUtils;
import org.apache.dubbo.spring.boot.autoconfigure.observability.ObservabilityUtils;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure.brave;
package org.apache.dubbo.spring.boot.autoconfigure.observability.brave;

import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.spring.boot.autoconfigure.DubboConfigurationProperties;
import org.apache.dubbo.spring.boot.observability.autoconfigure.DubboMicrometerTracingAutoConfiguration;
import org.apache.dubbo.spring.boot.observability.autoconfigure.ObservabilityUtils;
import org.apache.dubbo.spring.boot.observability.autoconfigure.annotation.ConditionalOnDubboTracingEnable;
import org.apache.dubbo.spring.boot.autoconfigure.observability.DubboMicrometerTracingAutoConfiguration;
import org.apache.dubbo.spring.boot.autoconfigure.observability.ObservabilityUtils;
import org.apache.dubbo.spring.boot.autoconfigure.observability.annotation.ConditionalOnDubboTracingEnable;

import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure.otel;
package org.apache.dubbo.spring.boot.autoconfigure.observability.otel;

import org.apache.dubbo.common.Version;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.spring.boot.autoconfigure.DubboConfigurationProperties;
import org.apache.dubbo.spring.boot.observability.autoconfigure.DubboMicrometerTracingAutoConfiguration;
import org.apache.dubbo.spring.boot.observability.autoconfigure.ObservabilityUtils;
import org.apache.dubbo.spring.boot.observability.autoconfigure.annotation.ConditionalOnDubboTracingEnable;
import org.apache.dubbo.spring.boot.autoconfigure.observability.DubboMicrometerTracingAutoConfiguration;
import org.apache.dubbo.spring.boot.autoconfigure.observability.ObservabilityUtils;
import org.apache.dubbo.spring.boot.autoconfigure.observability.annotation.ConditionalOnDubboTracingEnable;

import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure.exporter.otlp;
package org.apache.dubbo.spring.boot.autoconfigure.observability.otlp;

import org.apache.dubbo.config.nested.ExporterConfig.OtlpConfig;
import org.apache.dubbo.spring.boot.autoconfigure.DubboConfigurationProperties;
import org.apache.dubbo.spring.boot.observability.autoconfigure.annotation.ConditionalOnDubboTracingEnable;
import org.apache.dubbo.spring.boot.autoconfigure.observability.annotation.ConditionalOnDubboTracingEnable;

import java.util.Map;

Expand All @@ -34,7 +34,7 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

import static org.apache.dubbo.spring.boot.observability.autoconfigure.ObservabilityUtils.DUBBO_TRACING_OTLP_CONFIG_PREFIX;
import static org.apache.dubbo.spring.boot.autoconfigure.observability.ObservabilityUtils.DUBBO_TRACING_OTLP_CONFIG_PREFIX;
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_PREFIX;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.spring.boot.observability.autoconfigure.exporter.zipkin;
package org.apache.dubbo.spring.boot.autoconfigure.observability.zipkin;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down
Loading
Loading