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

add resource detectors to spring starter #10277

Merged

Conversation

zeitlinger
Copy link
Member

it's a lightweight dependency and very useful to get started

@zeitlinger zeitlinger requested a review from a team as a code owner January 18, 2024 12:37
@zeitlinger zeitlinger self-assigned this Jan 18, 2024
@@ -12,6 +12,7 @@ dependencies {
api("org.springframework.boot:spring-boot-starter:$springBootVersion")
api("org.springframework.boot:spring-boot-starter-aop:$springBootVersion")
api(project(":instrumentation:spring:spring-boot-autoconfigure"))
implementation(project(":instrumentation:resources:library"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you choose to add this as implementation when all the other dependencies are api?
secondly these resource providers use the SPI that the sdk autoconfigure module uses, but spring boot starter does not uses the sdk autoconfigure. Even if you add them do they actually do anything?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would see more the new dependency included in spring:spring-boot-autoconfigure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. implementation is more conservative (doesn't allow access to transitive dependencies), so I use that by default
  2. .. does not use autoconfigure ... -> I've been wondering the same - is there there a good reason for that?
  3. will it work? Yes, there's a guard that checks if the class exists

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeitlinger Could you develop one feature for OTel Spring autoconfiguration with this dependency and with one test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would see more the new dependency included in spring:spring-boot-autoconfigure.

autoconfigure modules should be as thin as possible, and starters add what's usually needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoconfigure modules should be as thin as possible, and starters add what's usually needed.

It's not the case. The Spring autoconfigure module contains all the Java code used by the OpenTelemetry starter and the Zipkin starter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resource library is compileOnly in Spring autoconfiguration. Do we want to include it by default?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it work? Yes, there's a guard that checks if the class exists

Thanks.

autoconfigure modules should be as thin as possible, and starters add what's usually needed.

I don't have a strong opinion for that. Might as well solve it by documenting that adding the resources library dependency can be useful. Perhaps this should be discussed at the SIG meeting.

@jeanbisutti
Copy link
Member

It would be great to document this on https://opentelemetry.io/ after the next release.

@jeanbisutti
Copy link
Member

@laurit We could merge this one as discussed during the last SIG meeting? I could follow up with a PR proposing to move some of the OTel starter dependencies to the autoconfiguration library.

@laurit
Copy link
Contributor

laurit commented Jan 31, 2024

@jeanbisutti I didn't participate in the last SIG meeting, feel free to proceed according to what you agreed at the SIG meeting. If we are going to include the resource detectors I think we should also consider including https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-boot-resources/library

@jeanbisutti
Copy link
Member

@jeanbisutti I didn't participate in the last SIG meeting, feel free to proceed according to what you agreed at the SIG meeting. If we are going to include the resource detectors I think we should also consider including https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-boot-resources/library

@laurit It seems I can't merge

@laurit
Copy link
Contributor

laurit commented Jan 31, 2024

@jeanbisutti you should be able to merge this, if you can't merge other approved PRs then we need to figure our why it is so

@laurit laurit merged commit 5969622 into open-telemetry:main Jan 31, 2024
47 checks passed
@trask
Copy link
Member

trask commented Jan 31, 2024

@laurit this is intentional (though we didn't have this repo set up correctly way back when you were an approver):

https://github.com/open-telemetry/community/blob/main/docs/how-to-configure-new-repository.md#branch-protection-rule-main

  • Restrict who can push to matching branches: ✔️
    • Organization administrators, repository administrators, and users with the Maintain role

@jeanbisutti
Copy link
Member

@jeanbisutti you should be able to merge this, if you can't merge other approved PRs then we need to figure our why it is so

@laurit Same thing for #10350, for which you have approved and I have not

@zeitlinger
Copy link
Member Author

@laurit It seems I can't merge

I also can't merge approved PRs

@zeitlinger zeitlinger deleted the spring-starter-include-resources branch January 31, 2024 15:29
@zeitlinger
Copy link
Member Author

zeitlinger commented Jan 31, 2024

If we are going to include the resource detectors I think we should also consider including https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-boot-resources/library

I'll create a follow-up PR for this.

Update: The user can't even enable the resource detector by adding the library manually, because the resource detectors not loaded generically (I'm not sure why actually).

steverao pushed a commit to steverao/opentelemetry-java-instrumentation that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants