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

Consider simplifying OpenTelemetryAutoConfiguration #36248

Open
vpavic opened this issue Jul 5, 2023 · 4 comments
Open

Consider simplifying OpenTelemetryAutoConfiguration #36248

vpavic opened this issue Jul 5, 2023 · 4 comments
Labels
theme: observability Issues related to observability type: enhancement A general enhancement

Comments

@vpavic
Copy link
Contributor

vpavic commented Jul 5, 2023

OpenTelemetryAutoConfiguration in its current shape contributes quite a few beans to the application context. In reality, most of those beans aren't likely be used anywhere (outside of contributing to OpenTelemetry bean) and appear to have been registered as beans just for the sake of being overridable (as they're @ConditionalOnMissingBean). However, the same effect (with lesser impact to application context) could have been achieved by having OpenTelemetry @Bean method accepting ObjectProvider arguments for different OTel components it depends on. Consequently, if I'm taking full control and configuring OpenTelemetry bean on my own, I'll still have all those OTel-related beans contributed to the application context.

So my proposal is to look into minimizing the number of OTel-related beans contributed to the application context, ideally reducing it to just OpenTelemetry bean.

More generally, the Actuator appears to me to be getting more and more bulky with time, and I'd like to see its impact on application context to be minimized, where possible.

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

Duplicates #34023.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2023
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 6, 2023
@mhalbritter mhalbritter added type: enhancement A general enhancement theme: observability Issues related to observability and removed status: duplicate A duplicate of another issue labels Jul 25, 2023
@mhalbritter mhalbritter added this to the General Backlog milestone Jul 25, 2023
@mhalbritter mhalbritter reopened this Jul 25, 2023
@mhalbritter
Copy link
Contributor

After talking about that, we decided to reopen the issue.

This issue (creating beans which are overridable which may then not be used) is a more general problem in most of our auto-configurations. Tackling this in a more general way may require effort in the Spring Framework. Before starting work on that, we should benchmark the impact of unused beans on the application context to assess if this is worth fixing.

@mhalbritter mhalbritter changed the title Consider simplfying OpenTelemetryAutoConfiguration Consider simplyfing OpenTelemetryAutoConfiguration Jul 25, 2023
@wilkinsona wilkinsona changed the title Consider simplyfing OpenTelemetryAutoConfiguration Consider simplifying OpenTelemetryAutoConfiguration Jul 25, 2023
@vpavic
Copy link
Contributor Author

vpavic commented Jul 25, 2023

Thanks for taking another look at this and breaking #34023 into several smaller, more focused, issues - I was about to suggest that.

This issue (creating beans which are overridable which may then not be used) is a more general problem in most of our auto-configurations. Tackling this in a more general way may require effort in the Spring Framework.

Maybe I'm missing something, but what's the point of having so many OpenTelemetry components registered as beans in the first place? In order to offer a possibility of customizing some bits of the configuration by consuming user-contributed beans, it isn't really necessary to have those same components registered as beans by auto-configuration.

@mhalbritter
Copy link
Contributor

mhalbritter commented Jul 26, 2023

Most (if not all) of the Spring Boot auto-configurations work in that way. They offer beans which are @ConditionalOnMissingBean so that users can override them. That's why we did it this way for OpenTelemetry, too.

It's technically possible to achieve that customizations without beans by using ObjectProvider, but before refactoring the whole auto-configuration, we want to take a step back and see if this problem can be solved in a more general way.

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

4 participants