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

Migration form 3.1.5 to 3.2.0 : "Default" Tracer is not provided in test anymore #38568

Closed
wyfrel opened this issue Nov 27, 2023 · 5 comments
Closed
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@wyfrel
Copy link

wyfrel commented Nov 27, 2023

I had an issue during the migration of a project from Spring Boot version 3.1.5 to 3.2.0.

In 3.1.5 the Spring boot test suite was providing a "default" tracer. I was not able to find the configuration who was adding this tracer. (May be this one ?

)

In Spring Boot 3.2.0, no default Tracer is configured. Is this a regression or a wanted behavior ? Maybe this change need to be documented if it's a wanted behavior ?

I've fixed my project by adding an tracer implementation (micrometer-tracing-bridge-otel in my case) and by migrating from the @WebMvcTest annotation to the @SpringBootTest annotation + @AutoConfigureMockMvc annotation

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 27, 2023
@wilkinsona
Copy link
Member

Thanks for the report. This change in behavior is a side-effect of #35354. For what were you using the Tracer API in a @WebMvcTest? It may be that we need to refine the auto-configurations that are included in the @WebMvcTest slice.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Nov 27, 2023
@wyfrel
Copy link
Author

wyfrel commented Nov 28, 2023

Hello Wilkinsona, i'm testing the behavior of an "Exception Handler" of my Rest service. I'm adding the trace information (traceId / SpanId ) of the request in the Response during the exception handling

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 28, 2023
@wilkinsona wilkinsona added for: team-meeting An issue we'd like to discuss as a team to make progress and removed status: feedback-provided Feedback has been provided labels Nov 28, 2023
@DuncanCasteleyn
Copy link

We are also running into this problem, we rely on tracer to be present during tests, our tests fail since Spring Boot 3.2.0

@mhalbritter mhalbritter self-assigned this Dec 6, 2023
@wilkinsona
Copy link
Member

We discussed this today. We think we may be able to modify @AutoConfigureObservability so that it can be used to opt into the auto-configuration of tracing and metrics in a sliced-test that otherwise would not have a Tracer or MeterRegistry available.

@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Dec 6, 2023
@wilkinsona wilkinsona added this to the 3.2.x milestone Dec 6, 2023
mhalbritter added a commit that referenced this issue Dec 12, 2023
This auto-configuration ensures, if Micrometer Tracing is on the
classpath, that there is always a tracer. It backs off if there is
already a tracer, for example contributed by the Brave or the Otel
auto-configurations, which are run before.

See gh-38568
@mhalbritter
Copy link
Contributor

mhalbritter commented Dec 12, 2023

@AutoConfigureObservability can now be applied to sliced tests. If done so, it will auto-configure an in-memory MeterRegistry, a no-op Tracer and an ObservationRegistry.

Another thing I've changed: if Micrometer Tracing is on the classpath, there's now always a Tracer in the context (for symmetry with MeterRegistry and ObservationRegistry, which are always available, too). If neither Brave nor Otel supplies a Tracer, a no-op tracer is auto-configured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

5 participants