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

Disable trace exporting via properties #34620

Closed
kuldeep0508 opened this issue Mar 16, 2023 · 11 comments
Closed

Disable trace exporting via properties #34620

kuldeep0508 opened this issue Mar 16, 2023 · 11 comments
Assignees
Labels
theme: observability Issues related to observability type: enhancement A general enhancement
Milestone

Comments

@kuldeep0508
Copy link

With spring boot 2.x below mentioned dependency is required for Sleuth to send spans to Zipkin or a Zipkin compliant tracing distribution system.
implementation 'org.springframework.cloud:spring-cloud-sleuth-zipkin'

But with spring boot 3.x this ZipkinAutoConfiguration is deafult present in org.springframework.boot.actuate.autoconfigure and gets enabled when

management.tracing.enabled = true

So MS start sending the spans.

In our case we rely on istio for this task and our micro-services are not supposed to send any data to zipkin server.

But with upgrade to springboot 3 this feature gets enabled as default and we get an error in our logs stating unabled to connect with zipkin server as we have not configure our MS to do this task.

I check there is no property to control the enablement of this behaviour.

So is there any plan to provide any properties like below to control this behavior.

management.tracing.zipkin.enabled = true/false

And as a workaround should we write noopZipkinSpanHandler ?

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

Does this help you? https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using.auto-configuration.disabling-specific

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Mar 16, 2023
@kuldeep0508 kuldeep0508 changed the title Is there any way to disable ZipkinAutoConfiguration which is enabled by default. Possiblity to disable ZipkinAutoConfiguration which is enabled by default. Mar 16, 2023
@kuldeep0508
Copy link
Author

Does this help you? https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using.auto-configuration.disabling-specific

It worked thanks :) ,

but it may be good for a better control over it we can have a property for enable or disable it in future.

@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 Mar 16, 2023
@mhalbritter
Copy link
Contributor

In Boot, we refrain from adding enabled properties if there are some other signals. In this case, the signal is Zipkin on the classpath. And if for some reason (like in your case) Zipkin is on the classpath and you don't want Zipkin to be enabled, exclude the auto-configuration.

@mhalbritter mhalbritter added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Mar 16, 2023
@mhalbritter mhalbritter closed this as not planned Won't fix, can't repro, duplicate, stale Mar 16, 2023
@nioertel
Copy link

nioertel commented Mar 4, 2024

I understand this argument for Spring Boot 3.3.x.

However with Spring Boot 3.2.x and before, Brave 5.x is used and there brave.Span directly depends on zipkin2.Endpoint. Removing Zipkin from the classpath is not a viable option.
Therefore I would not consider the presence of Zipkin on the classpath as sufficient signal.

@mhalbritter
Copy link
Contributor

In that case, please use the auto-configuration disable feature, as I said here. We won't add an enabled flag in the 3.2.x line anyway, as it only gets bugfixes and dependency upgrades, but no new features.

@kubav182
Copy link

Why should we mess our config with autoconfig exclusions?
spring.zipkin.enabled - simple, clear and intuitive
spring.autoconfigure.exclude=org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration why should i write this to config and search for this long classpath? IDE can help you but usually you have external config where is no autocomplete for spring boot packages. The user experience should be considered too. Spring Boot and its changes should make it easier not harder.

@rivancic
Copy link

rivancic commented May 15, 2024

I have Zipkin on the classpath as application will use zipkin exporter when deployed in such environment.
OFC for local testing I don't need it. And like mentioned above, my first go to is to check Spring common application properties in how to enable/disable behavior. Now in this case you really have to know about the Autoconfiguration class.

@rishiraj88
Copy link

I fully agree with @rivancic . Autoconfiguration is so versatile and dependable.
We should always look up to this in first place while changing the inclusion/enabling of dependencies "automatically". It's such a powerful automation.

@kubav182
Copy link

Exactly we need to disable exporter for some reasons (tests, local env, maybe you dont need to export spans on every dev/test env). Removing zipkin from classpath is not option as we would have to make new build for each env. So having zipkin on classpath as signal is not the best option. Disabling autoconfiguration in yaml/properties is not user friendly from my point of view because we have to know all the autoconfigs relying on this signal instead of one shared enabled property. For example for redis there are 2 autoconfigs one relying on classpath and one relying on property it is quite confusing. I understand the argument there is complexity to have many ways to do the same thing, but our arguments are also valid I think.

@mhalbritter mhalbritter added the for: team-meeting An issue we'd like to discuss as a team to make progress label May 21, 2024
@philwebb philwebb added type: enhancement A general enhancement and removed status: declined A suggestion or change that we don't feel we should currently apply for: team-meeting An issue we'd like to discuss as a team to make progress labels Jun 6, 2024
@philwebb philwebb added this to the 3.4.x milestone Jun 6, 2024
@wilkinsona wilkinsona reopened this Jun 6, 2024
@mhalbritter
Copy link
Contributor

mhalbritter commented Jun 6, 2024

We talked about that and decided to add a .enabled property. This mirrors our metrics properties, e.g. there's a management.prometheus.metrics.export.enabled property, or a management.graphite.metrics.export.enabled. We want to do that for our tracing backends, too.

With these properties, users can disable the exporting of data without fiddling with the classpath.

@mhalbritter mhalbritter changed the title Possiblity to disable ZipkinAutoConfiguration which is enabled by default. Disable trace exporting via properties Jun 6, 2024
@philwebb philwebb modified the milestones: 3.4.x, 3.5.x Jun 17, 2024
@philwebb philwebb added the theme: observability Issues related to observability label Jun 17, 2024
mhalbritter added a commit to mhalbritter/spring-boot that referenced this issue Jun 18, 2024
There are now three new properties, which control the trace exporting on
a more fine-grained level:

- management.tracing.otlp.enabled
- management.tracing.wavefront.enabled
- management.tracing.zipkin.enabled

They default to null, and if set, take precedence over the global
management.metrics.enabled property.

Closes spring-projectsgh-34620
@mhalbritter
Copy link
Contributor

mhalbritter commented Jun 18, 2024

Changes are here and ready to be merged as soon as we have our 3.3.x branch: https://github.com/mhalbritter/spring-boot/tree/mh/34620-disable-trace-exporting-via-properties

mhalbritter added a commit to mhalbritter/spring-boot that referenced this issue Jun 18, 2024
There are now three new properties, which control the trace exporting on
a more fine-grained level:

- management.otlp.tracing.export.enabled
- management.wavefront.tracing.export.enabled
- management.zipkin.tracing.export.enabled

They default to null, and if set, take precedence over the global
management.metrics.enabled property.

Closes spring-projectsgh-34620
@mhalbritter mhalbritter modified the milestones: 3.4.x, 3.4.0-M1 Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: observability Issues related to observability type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

9 participants