Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define the scopes of Spring Observability - Tracing #21969

Closed
Tracked by #23402
saragluna opened this issue Jun 1, 2021 · 1 comment
Closed
Tracked by #23402

Define the scopes of Spring Observability - Tracing #21969

saragluna opened this issue Jun 1, 2021 · 1 comment
Assignees
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.

Comments

@saragluna
Copy link
Member

saragluna commented Jun 1, 2021

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.

@saragluna saragluna added the azure-spring All azure-spring related issues label Jun 1, 2021
@saragluna saragluna added the Client This issue points to a problem in the data-plane of the library. label Jun 1, 2021
@saragluna saragluna self-assigned this Jun 1, 2021
@saragluna saragluna added this to the [2021] July milestone Jun 1, 2021
@saragluna saragluna modified the milestones: [2021] July, Backlog Jun 1, 2021
@saragluna saragluna modified the milestones: Backlog, [2021] October Sep 2, 2021
@saragluna saragluna assigned moarychan and unassigned saragluna Sep 2, 2021
@moarychan moarychan added Epic feature-request This issue requires a new behavior in the product in order be resolved. and removed Epic labels Oct 8, 2021
@saragluna
Copy link
Member Author

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

See #24652 and #24651.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.
Projects
None yet
Development

No branches or pull requests

2 participants