Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.35k stars 1.99k forks source link

Define the scopes of Spring Observability - Tracing #21969

Closed saragluna closed 3 years ago

saragluna commented 3 years ago

Context

For Spring applications, there is already good tracing support by Spring Cloud Sleuth, the tracing information of your request and messages will be recorded successfully, also complete trace information is able to export.

Unfortunately, when using the Azure Spring Starter and Spring Cloud Sleuth Starter together, such as azure-spring-boot-starter-storage and spring-cloud-starter-sleuth, only the Spring level trace information can be recorded, the activities of Azure SDK will not be recorded..

e.g: We expect it to be like this in Zipkin UI: image

Problem

Azure SDK defines the tracing interface, and the default implementation is OpenTelemetryHttpPolicy and OpenTelemetryTracer which is based on Open Telemetry, but Spring Cloud Sleuth is well used for tracing in the Spring community. When using Spring Cloud Sleuth Starter, Spring Cloud Sleuth Starter will not enable the Azure SDK tracing feature unless we use the Spring Cloud Sleuth API to implement the Azure SDK tracing interface.

Rationale

Azure SDK will enable the tracing when the ServiceLoader can load the implementation successfully.

Solution

Goal

When the Spring Cloud Sleuth is enabled in an application, Sleuth will record the activities of Azure SDK services, which includes the below service clients: Please note: These activities will not contain authentication from Azure Active Directory, such as token acquire, etc.

saragluna commented 3 years ago

Closing this issue now. The implementation will be integrating sleuth with http-based clients and amqp-based clients.

See #24652 and #24651.