Skip to content

Define the scopes of Spring Observability - Tracing #21969

Closed

Description

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.

  • AfterRetryPolicyProvider implementation is used for service based on HTTP protocol. You can find the method stack in HttpPolicyProviders class. The SDK service builder provides upstream with an entrance to add an HTTP pipeline policy, which will be applied to HttpPipeline to process spans for each HTTP request for Azure service.
  • Tracer implementation is used for service based on AMQP protocol. It will be used by the TracerProviderclass.
    Here we need SDK to open custom TracerProvider capability (Feature request: Service Bus | Event hubs), otherwise, we will be blocked.

Solution

  • Core implementation for Sleuth
    Add new module azure-spring-cloud-trace-sleuth. Each Azure SDK Service depends on Azure Core interfaces, implements Azure SDK tracing implementation by Sleuth API

  • Auto-configure in Spring Boot
    Delegates the tracer of azure-spring-cloud-trace-sleuth module to the Sleuth tracer context, which means the Azure SDK tracing will use the same Tracer instance from the Spring application context finally.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.azure-springAll azure-spring related issuesfeature-requestThis issue requires a new behavior in the product in order be resolved.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions