This repo used Spring Cloud Sleuth
and Opentelemetry
to track Service Bus SDK
, Zipkin
as a server for ui display.
There is a gap between service bus and zipkin, the dependency between consumers and producers in the service bus cannot be fully displayed.
This document is some conclusions about tracing the service bus through the above methods.
This repo contains three parts, [ServiceBus JMS](#ServiceBus JMS), [ServiceBus Multibinders](#ServiceBus Multibinders) and ZipkinServer. Tracking the service bus, also refer to Spring cloud sleuth otel and Track Azure SDK for Java.
Running this repo will be charged by Azure. You can check the usage and bill at this link. Go to Azure portal and create the service by following this link.
- Java Development Kit (JDK) with version 11
- Azure Subscription
- Maven 3.0 and above
If you want to clone from master, jump to Clone project from master branch.
Note that there is no need to add a version
as those are managed already by the project.
It means cloning the master branch, all the code, dependencies, and readme files are up to date.
-
Clone code to local repo
git clone https://github.com/wujack778/Tracing-service-bus-by-sleuth-and-Opentelemetry.git
-
Traverse to the root directory
The module azure-servicebus-jms-queue-supplier
and the module azure-servicebus-jms-queue-consumer
are refer to Service Bus Jms
For the configuration of their application.yaml
, please refer to Service Bus Jms Readme.
- Run with Maven
cd Tracing-service-bus-by-sleuth-and-Opentelemetry/azure-servicebus-jms-queue-consumer mvn spring-boot:run cd Tracing-service-bus-by-sleuth-and-Opentelemetry/azure-servicebus-jms-queue-supplier mvn spring-boot:run cd Tracing-service-bus-by-sleuth-and-Opentelemetry/zipkin-server mvn spring-boot:run
- Send a POST request to service bus queue.
$ curl -X POST localhost:8899/queue?message=hello
- Verify in your app's logs that a similar message was posted:
Sending message Received message from queue: hello
- Zipkin server will show the results of tracing ZipkinServer.
Module azure-servicebus-queue-multibinders-consumer01
, Module azure-servicebus-queue-multibinders-consumer02
and Module azure-servicebus-queue-multibinders-supplier
are refer to Service Bus Multi binders
For the configuration of their application.yaml
, please refer to Service Bus Multi binders Config
- Run with Maven
cd Tracing-service-bus-by-sleuth-and-Opentelemetry/azure-servicebus-queue-multibinders-consumer01 mvn spring-boot:run cd Tracing-service-bus-by-sleuth-and-Opentelemetry/azure-servicebus-queue-multibinders-consumer02 mvn spring-boot:run cd Tracing-service-bus-by-sleuth-and-Opentelemetry/azure-servicebus-queue-multibinders-supplier mvn spring-boot:run cd Tracing-service-bus-by-sleuth-and-Opentelemetry/zipkin-server mvn spring-boot:run
- Send a POST request to test the default binder.
$ curl -X POST localhost:9000/messages1?message=hello
- Verify in your app's logs that a similar message was posted:
New message1 received: 'hello' Message1 'hello' successfully checkpointed
- Send another POST request to test the other binder
$ curl -X POST localhost:9000/messages2?message=hello
- Verify in your app's logs that a similar message was posted:
New message2 received: 'hello' Message2 'hello' successfully checkpointed
- Zipkin server will show the results of tracing ZipkinServer.
-
Request to zipkin server Go back to your browser and request the following link http://localhost:8080/, you will see the following situation:
-
View the tracing result
-
Every span, time consuming per span and request will be displayed.
-
Click every span, traceId, spanId, parentId will be displayed.
-
Click the Dependencies, the topological diagram of the dependencies will be displayed.
Properties | Description |
---|---|
spring.application.name | Customize your application name |
server.port | Customize your application server port |
spring.sleuth.sampler.probability | Probability of requests that should be sampled, eg 0.5 or 1 |
spring.zipkin.base-url | Base url of your zipkin server |