Skip to content

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

@wyfrel

Description

@wyfrel

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

Activity

wilkinsona

wilkinsona commented on Nov 27, 2023

@wilkinsona
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.

wyfrel

wyfrel commented on Nov 28, 2023

@wyfrel
Author

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

added
for: team-meetingAn issue we'd like to discuss as a team to make progress
and removed on Nov 28, 2023
DuncanCasteleyn

DuncanCasteleyn commented on Nov 30, 2023

@DuncanCasteleyn

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

self-assigned this
on Dec 6, 2023
wilkinsona

wilkinsona commented on Dec 6, 2023

@wilkinsona
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.

added
type: regressionA regression from a previous release
and removed
for: team-meetingAn issue we'd like to discuss as a team to make progress
on Dec 6, 2023
added this to the 3.2.x milestone on Dec 6, 2023
mhalbritter

mhalbritter commented on Dec 12, 2023

@mhalbritter
Contributor

@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.

modified the milestones: 3.2.x, 3.2.1 on Dec 12, 2023
added a commit that references this issue on Jan 25, 2024
198dbb4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @wilkinsona@wyfrel@DuncanCasteleyn@spring-projects-issues@mhalbritter

      Issue actions

        Migration form 3.1.5 to 3.2.0 : "Default" Tracer is not provided in test anymore · Issue #38568 · spring-projects/spring-boot