Skip to content

@AutoConfigureObservability has unintentional consequences on integration tests #35354

Closed
@mhalbritter

Description

@mhalbritter

By default, metrics and tracing are disabled in @SpringBootTest integration tests. While the MeterRegistry gets replaced by a SimpleMeterRegistry which collects the metrics in-memory, we replace the Micrometer Tracing Tracer with a noop implementation.

There are other beans which are @ConditionalOnEnabledTracing, and those don't get created when running in a integration test. If users happen to have code using these beans they observe that the application is running fine when starting main, but fail with a missing bean when running the @SpringBootTest. This is strange behavior and we should think about if we want to behave this way.

We initially designed it that way so that integration tests don't send metrics / traces to monitoring systems. Ideally we would replace such beans with in memory implementations, but I don't think this is feasible for all affected beans.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions