This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 389a4758 docs: modify dubbo-samples-spring-boot3 readme (#736)
389a4758 is described below
commit 389a4758c5bb79cc25378ddf8011a41a0d3d895c
Author: conghuhu <[email protected]>
AuthorDate: Wed Feb 15 15:05:23 2023 +0800
docs: modify dubbo-samples-spring-boot3 readme (#736)
---
.../dubbo-samples-spring-boot3-tracing/README.md | 157 +++++++++++++--------
.../{ => static}/zipkin.png | Bin
.../static/zipkin_home.png | Bin 0 -> 66737 bytes
3 files changed, 96 insertions(+), 61 deletions(-)
diff --git a/4-governance/dubbo-samples-spring-boot3-tracing/README.md
b/4-governance/dubbo-samples-spring-boot3-tracing/README.md
index 20c8099d..afae6016 100644
--- a/4-governance/dubbo-samples-spring-boot3-tracing/README.md
+++ b/4-governance/dubbo-samples-spring-boot3-tracing/README.md
@@ -1,15 +1,53 @@
# Overview
-Apache Dubbo has inbuilt tracing through [Micrometer
Observations](https://micrometer.io/)
-and [Micrometer Tracing](https://github.com/micrometer-metrics/tracing).
+This example demonstrates the basic usage of tracing in Dubbo application and
report tracing information to zipkin. This
+example contains three parts, `dubbo-samples-spring-boot3-tracing-provider`
+, `dubbo-samples-spring-boot3-tracing-consumer` and
`dubbo-samples-spring-boot3-tracing-interface`.
-## 1. Adding Micrometer Observation To Your Project
+Apache Dubbo has inbuilt tracing through [Micrometer
Observations](https://micrometer.io/) and [Micrometer
Tracing](https://github.com/micrometer-metrics/tracing).
+
+## Quick Start
+
+### Install & Start Zipkin
+
+Follow [Zipkin's quick start](https://zipkin.io/pages/quickstart.html) to
install zipkin.
+
+Here we use docker to quickly start a zipkin server.
+
+```bash
+docker run -d -p 9411:9411 --name zipkin openzipkin/zipkin
+```
+
+Then you can verify zipkin server works by access
[http://localhost:9411](http://localhost:9411)
+
+
+
+### Install & Start Nacos
+
+Follow [Nacos's quick
start](https://nacos.io/zh-cn/docs/v2/quickstart/quick-start.html) to install
and start nacos.
+
+### Start Provider
+
+Start `org.apache.dubbo.springboot.demo.provider.ProviderApplication` directly
from IDE.
+
+### Start Consumer
+
+Start `org.apache.dubbo.springboot.demo.consumer.ConsumerApplication` directly
from IDE.
+
+### Check Result
+
+Open [http://localhost:9411/zipkin/](http://localhost:9411/zipkin/) in browser.
+
+
+
+## How To Use Dubbo Tracing In Your Project
+
+### 1. Adding Micrometer Observation To Your Project
In order to add Micrometer to the classpath and add metrics for Dubbo you need
to add the `dubbo-metrics-api` dependency
as shown below:
```xml
-
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-api</artifactId>
@@ -20,83 +58,43 @@ Thanks to the usage of [Micrometer
Observations](https://micrometer.io/) Dubbo g
the setup will allow emission of metrics, tracer or other signals via custom
`ObservationHandlers`. Please read
the [documentation under docs/observation](https://micrometer.io) for more
information.
-## 2. Adding Micrometer Tracing Bridge To Your Project
+### 2. Adding Micrometer Tracing Bridge To Your Project
In order to start creating spans for Dubbo based projects a `bridge` between
Micrometer Tracing and an actual Tracer is
required.
> NOTE: Tracer is a library that handles lifecycle of spans (e.g. it can
> create, start, stop, sample, report spans).
-Micrometer Tracing supports [Brave](https://github.com/openzipkin/brave)
-and [OpenTelemetry](https://github.com/open-telemetry/opentelemetry-java) as
Tracers as shown below:
+Micrometer Tracing supports
[OpenTelemetry](https://github.com/open-telemetry/opentelemetry-java) and
[Brave](https://github.com/openzipkin/brave) as Tracers. Dubbo recommends using
OpenTelemetry as the protocol of tracing, you can add dependency as shown below:
```xml
-
-<!-- Brave Tracer -->
+<!-- OpenTelemetry Tracer -->
<dependency>
<groupId>io.micrometer</groupId>
- <artifactId>micrometer-tracing-bridge-brave</artifactId>
-</dependency>
-
- <!-- OpenTelemetry Tracer -->
-<dependency>
-<groupId>io.micrometer</groupId>
-<artifactId>micrometer-tracing-bridge-otel</artifactId>
+ <artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
```
-## 3. Adding Micrometer Tracing Exporter To Your Project
+### 3. Adding Micrometer Tracing Exporter To Your Project
After having added the Tracer, an exporter (also known as a reporter) is
required. It's a component that will export the
finished span and send it to a reporting system. Micrometer Tracer natively
supports Tanzu Observability by Wavefront
-and Zipkin as shown below:
-
-Tanzu Observability by Wavefront
-
-```xml
-
-<dependency>
- <groupId>io.micrometer</groupId>
- <artifactId>micrometer-tracing-reporter-wavefront</artifactId>
-</dependency>
-```
-
-OpenZipkin Zipkin with Brave
-
-```xml
-
-<dependency>
- <groupId>io.zipkin.reporter2</groupId>
- <artifactId>zipkin-reporter-brave</artifactId>
-</dependency>
-```
+and Zipkin. Let's take zipkin as an example as shown below:
OpenZipkin Zipkin with OpenTelemetry
```xml
-
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-zipkin</artifactId>
</dependency>
```
-An OpenZipkin URL sender dependency to send out spans to Zipkin via a
URLConnectionSender
-
-```xml
-
-<dependency>
- <groupId>io.zipkin.reporter2</groupId>
- <artifactId>zipkin-sender-urlconnection</artifactId>
-</dependency>
-```
-
You can read more about tracing setup [this documentation, under
docs/tracing](https://micrometer.io/).
-## 4. Configuration ObservationRegistry
+### 4. Configuration ObservationRegistry
```java
-
@Configuration
public class ObservationConfiguration {
@@ -116,18 +114,55 @@ public class ObservationConfiguration {
}
```
-## 5. Result
-
-Start provider firstly, then start consumer.
-
-Open [http://localhost:9411/zipkin/](http://localhost:9411/zipkin/) in browser.
-
-
-
-## 6. Customizing Observation Filters
+### 5. Customizing Observation Filters
To customize the tags present in metrics (low cardinality tags) and in spans
(low and high cardinality tags) you should
create your own versions of `DubboServerObservationConvention` (server side)
and `DubboClientObservationConvention` (
client side) and register them in the `ApplicationModel`'s `BeanFactory`. To
reuse the existing ones
check `DefaultDubboServerObservationConvention` (server side) and
`DefaultDubboClientObservationConvention` (client
-side).
\ No newline at end of file
+side).
+
+
+
+## Extension
+
+### Other Micrometer Tracing Bridge
+
+```xml
+<!-- Brave Tracer -->
+<dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-tracing-bridge-brave</artifactId>
+</dependency>
+```
+
+
+
+### Other Micrometer Tracing Exporter
+
+Tanzu Observability by Wavefront
+
+```xml
+<dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-tracing-reporter-wavefront</artifactId>
+</dependency>
+```
+
+OpenZipkin Zipkin with Brave
+
+```xml
+<dependency>
+ <groupId>io.zipkin.reporter2</groupId>
+ <artifactId>zipkin-reporter-brave</artifactId>
+</dependency>
+```
+
+An OpenZipkin URL sender dependency to send out spans to Zipkin via a
URLConnectionSender
+
+```xml
+<dependency>
+ <groupId>io.zipkin.reporter2</groupId>
+ <artifactId>zipkin-sender-urlconnection</artifactId>
+</dependency>
+```
diff --git a/4-governance/dubbo-samples-spring-boot3-tracing/zipkin.png
b/4-governance/dubbo-samples-spring-boot3-tracing/static/zipkin.png
similarity index 100%
rename from 4-governance/dubbo-samples-spring-boot3-tracing/zipkin.png
rename to 4-governance/dubbo-samples-spring-boot3-tracing/static/zipkin.png
diff --git
a/4-governance/dubbo-samples-spring-boot3-tracing/static/zipkin_home.png
b/4-governance/dubbo-samples-spring-boot3-tracing/static/zipkin_home.png
new file mode 100644
index 00000000..be1e08ba
Binary files /dev/null and
b/4-governance/dubbo-samples-spring-boot3-tracing/static/zipkin_home.png differ
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]