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

'management.tracing.enabled=false' does not disable tracing propagation in Spring Boot 3.2.0 #38625

Closed
lkleeven opened this issue Dec 1, 2023 · 15 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@lkleeven
Copy link

lkleeven commented Dec 1, 2023

Before Spring Boot 3.2.0 setting the management.tracing.enabled property to false would also disable the underlying tracing propagation. However with Spring Boot 3.2.0 things have changed with regards to observability. As far as I understand this should have only affected how to test observability.

However, if I now run an application with tracing support and set the management.tracing.enabled to false I can see that the application still propagates tracing headers (or starts a new trace). I expected that setting management.tracing.enabled to false would also disable tracing propagation (and starting new traces).

I've reproduced the problem in this minimal Spring Boot project. The project has an included unit test that now fails. You can run it with .mvnw clean verify. Alternatively, you can run the application and do a call to the /demo endpoint which should return true but now returns false due to the suspected bug.

I've based my reproduction on a simple premise where you can call the /demo endpoint, which will then call another endpoint. That one checks if the traceparent header has been set. If so it returns false because we expect it not to be set, otherwise it returns true. In the applications properties the management.tracing.enabled property is set to false. Extra logging is present to help in debugging.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 1, 2023
@mhalbritter
Copy link
Contributor

mhalbritter commented Dec 1, 2023

management.tracing.enabled was never intended to switch off tracing in production apps. Its sole purpose was to disable tracing in tests. In hindsight it was a mistake that it ended up user visible in the documentation.

As we restructured the bean arrangement in #35354, now only the reporting beans are disabled when management.tracing.enabled is false. The beans which do the propagation are still in place.

If you want to disable propagation or tracing, please remove the dependencies from the classpath. Generally in Boot, we don't have enabled properties if there's a better signal, which in this case is the presence of classes on the classpath.

@lkleeven
Copy link
Author

lkleeven commented Dec 1, 2023

In that case, could you at least update the documentation for the property?

@mhalbritter
Copy link
Contributor

Sure, i've opened #38626 for that.

@mhalbritter mhalbritter closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
@mhalbritter mhalbritter added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 1, 2023
@lkleeven
Copy link
Author

lkleeven commented Dec 1, 2023

Too bad that there won't be a property to disable this. In our experience providing a Spring Boot based framework to our company, having such properties has been invaluable to quickly help teams progress. If only to allow the option to quickly disable functionality in case of troubleshooting or production issues.

@mhalbritter
Copy link
Contributor

mhalbritter commented Dec 1, 2023

You won't find a lot of enabled properties in Spring Boot. Features are usually enabled if a certain JAR is on the classpath. If you don't want a particular feature, either remove the JAR from the classpath or disable the auto-configuration.

@lkleeven
Copy link
Author

lkleeven commented Dec 1, 2023

They might not all have the ability to disable whole feature sets, but the properties documentation shows 152 enabled properties. Which we are happy users of because, like I said, this makes it much easier to test and troubleshoot issues.

@mhalbritter
Copy link
Contributor

mhalbritter commented Dec 1, 2023

You're right, I should have said "You won't find a lot of enabled properties in Spring Boot that are detectable via a different signal".

These properties you linked to enable/disable features which are not detectable via other means.

@lkleeven
Copy link
Author

lkleeven commented Dec 1, 2023

As my final remark. The main reason for the request is the ease of use. I'm not just asking for myself, but also for the over 600 engineers in our company who use our own Spring Boot based framework daily. But if this is not a good enough reason for you, I'll leave it at that.

@quaff
Copy link
Contributor

quaff commented Dec 4, 2023

You won't find a lot of enabled properties in Spring Boot. Features are usually enabled if a certain JAR is on the classpath. If you don't want a particular feature, either remove the JAR from the classpath or disable the auto-configuration.

Then we need to build different artifacts for different deployments, I'd like build once and run for all by disable/enable feature flag.

@mhalbritter
Copy link
Contributor

You can also disable auto-configuration with a property, see here.

@quaff
Copy link
Contributor

quaff commented Dec 4, 2023

see here

It's not very handy either since spring.autoconfigure.exclude is not easy for overriding, see #27414

@mhalbritter
Copy link
Contributor

All auto-configurations work like that, I don't see why the auto-configuration for tracing should have a feature flag while the others don't.

@quaff
Copy link
Contributor

quaff commented Dec 4, 2023

All auto-configurations work like that, I don't see why the auto-configuration for tracing should have a feature flag while the others don't.

I'm discussing enable/disable feature by including dependency. But it's more desired for tracing, It's very common that an application need tracing for production deployment but not needed for SIT/UAT deployment.

@mhalbritter
Copy link
Contributor

Okay. If you have that use case, please open an issue explaining why you need an enabled flag for tracing (and I guess the rest of observability?) and I'll bring it up in our next team meeting.

@mhalbritter
Copy link
Contributor

Hey @lkleeven, we talked about that tracing disabling in our meeting and decided to make that management.tracing.enabled flag more official. What it does in 3.2.1 is that it disables span exporting (sending traces to your backend) and also trace propagation over the wire (e.g. HTTP). See #38641 for details.

@philwebb philwebb changed the title management.tracing.enabled=false does not disable tracing propagation in Spring Boot 3.2.0 'management.tracing.enabled=false' does not disable tracing propagation in Spring Boot 3.2.0 Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants