Skip to content

Commit

Permalink
feat: add tracing starters && add zipkin auto configuration (#12013)
Browse files Browse the repository at this point in the history
* fix: fix observ-starter some bugs

* faet: add zipkin auto configuration

* fix: remove zipkin endpoint default value

* feat: add prometheus client bom to observability starter

* feat: add observability starters

* fix: add license

* feat: add observability-brave-zipkin-starter to dubbo-distribution

* fix: add moudles to dubbo-bom

* stylelint

* chore: change observ starter name

* fix
  • Loading branch information
conghuhu authored Apr 15, 2023
1 parent 736d996 commit 559b13a
Show file tree
Hide file tree
Showing 30 changed files with 1,269 additions and 99 deletions.
3 changes: 3 additions & 0 deletions .artifacts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ dubbo-spring-boot-autoconfigure
dubbo-spring-boot-autoconfigure-compatible
dubbo-spring-boot-compatible
dubbo-spring-boot-observability-starter
dubbo-spring-boot-observability-autoconfigure
dubbo-spring-boot-tracing-brave-zipkin-starter
dubbo-spring-boot-tracing-otel-zipkin-starter
dubbo-spring-boot-starter
dubbo-spring-security
dubbo-xds
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.dubbo.config;

import org.apache.dubbo.config.nested.BaggageConfig;
import org.apache.dubbo.config.nested.ExporterConfig;
import org.apache.dubbo.config.nested.PropagationConfig;
import org.apache.dubbo.config.nested.SamplingConfig;
import org.apache.dubbo.config.support.Nested;
Expand Down Expand Up @@ -49,6 +51,12 @@ public class TracingConfig extends AbstractConfig {
@Nested
private PropagationConfig propagation = new PropagationConfig();

/**
* Exporter configuration.
*/
@Nested
private ExporterConfig tracingExporter = new ExporterConfig();

public TracingConfig() {
}

Expand Down Expand Up @@ -87,4 +95,12 @@ public PropagationConfig getPropagation() {
public void setPropagation(PropagationConfig propagation) {
this.propagation = propagation;
}

public ExporterConfig getTracingExporter() {
return tracingExporter;
}

public void setTracingExporter(ExporterConfig tracingExporter) {
this.tracingExporter = tracingExporter;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.dubbo.config.nested;

import org.apache.dubbo.config.support.Nested;

import java.io.Serializable;
import java.time.Duration;

public class ExporterConfig implements Serializable {

@Nested
private ZipkinConfig zipkinConfig;

public ZipkinConfig getZipkinConfig() {
return zipkinConfig;
}

public void setZipkinConfig(ZipkinConfig zipkinConfig) {
this.zipkinConfig = zipkinConfig;
}

public static class ZipkinConfig implements Serializable {

/**
* URL to the Zipkin API.
*/
private String endpoint;

/**
* Connection timeout for requests to Zipkin.
*/
private Duration connectTimeout = Duration.ofSeconds(1);

/**
* Read timeout for requests to Zipkin.
*/
private Duration readTimeout = Duration.ofSeconds(10);

public String getEndpoint() {
return endpoint;
}

public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}

public Duration getConnectTimeout() {
return connectTimeout;
}

public void setConnectTimeout(Duration connectTimeout) {
this.connectTimeout = connectTimeout;
}

public Duration getReadTimeout() {
return readTimeout;
}

public void setReadTimeout(Duration readTimeout) {
this.readTimeout = readTimeout;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@
<xsd:complexType name="baggageType">
<xsd:all>
<xsd:element ref="remoteFields" minOccurs="0"/>
<xsd:element ref="correlation" minOccurs="0"/>
</xsd:all>
<xsd:attribute name="enabled" type="xsd:boolean">
<xsd:annotation>
Expand Down Expand Up @@ -1238,6 +1239,33 @@
</xsd:simpleContent>
</xsd:complexType>

<xsd:complexType name="tracingExporterType">
<xsd:all>
<xsd:element ref="zipkin-config" minOccurs="0"/>
</xsd:all>
</xsd:complexType>

<xsd:complexType name="zipkinConfigType">
<xsd:attribute name="endpoint" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The url of zipkin server. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="connectTimeout" type="xsd:duration">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Connection timeout for requests to Zipkin. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="readTimeout" type="xsd:duration">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Read timeout for requests to Zipkin. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>

<xsd:complexType name="methodType">
<xsd:complexContent>
<xsd:extension base="abstractMethodType">
Expand Down Expand Up @@ -2187,4 +2215,18 @@
means that these fields would end up as key-value pairs in e.g. MDC. ]]></xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="tracing-exporter" type="tracingExporterType">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Exporter of tracing. ]]></xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="zipkin-config" type="zipkinConfigType">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Config of zipkin exporter. ]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-observability-starter</artifactId>
<artifactId>dubbo-spring-boot-tracing-otel-zipkin-starter</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<!-- Observability -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-observability-starter</artifactId>
<artifactId>dubbo-spring-boot-tracing-otel-zipkin-starter</artifactId>
</dependency>

<dependency>
Expand Down
15 changes: 15 additions & 0 deletions dubbo-distribution/dubbo-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,21 @@
<artifactId>dubbo-spring-boot-observability-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-observability-autoconfigure</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-tracing-otel-zipkin-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-tracing-brave-zipkin-starter</artifactId>
<version>${project.version}</version>
</dependency>

<!-- test -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dubbo-spring-boot-observability-starter</artifactId>
<groupId>org.apache.dubbo</groupId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dubbo-spring-boot-observability-autoconfigure</artifactId>

<dependencies>
<!-- micrometer -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>com.tdunning</groupId>
<artifactId>t-digest</artifactId>
</dependency>

<!-- spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</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>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</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.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>

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

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

</project>
Loading

0 comments on commit 559b13a

Please sign in to comment.