-
Notifications
You must be signed in to change notification settings - Fork 834
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
Move autoconfigure getConfig to internal, remove getResource #5467
Move autoconfigure getConfig to internal, remove getResource #5467
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #5467 +/- ##
============================================
- Coverage 91.38% 91.36% -0.02%
- Complexity 4964 4965 +1
============================================
Files 551 552 +1
Lines 14571 14576 +5
Branches 1358 1358
============================================
+ Hits 13315 13318 +3
- Misses 868 870 +2
Partials 388 388
☔ View full report in Codecov by Sentry. |
@@ -51,10 +51,10 @@ static AutoConfiguredOpenTelemetrySdk create( | |||
public abstract OpenTelemetrySdk getOpenTelemetrySdk(); | |||
|
|||
/** Returns the {@link Resource} that was auto-configured. */ | |||
public abstract Resource getResource(); | |||
abstract Resource getResource(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this remove the only supported way to get an autoconfigured Resource? In cases where people want to manually configure everything except the Resource, I believe this was the only possible way to do it. This is a useful thing to be able to do, and this change makes it even harder to access.
I've been a strong proponent of having a way to get access to an autoconfigured Resource instance, and have had to settle for this being the only way. This change would now make it impossible to do in a supported way.
If we're going to remove this, we should provide a supported way for users to get the resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this remove the only supported way to get an autoconfigured Resource?
Well its been moved to an internal API, but yes, it removes it from the proposed stable API.
Can you remind me of some of the use cases of accessing the autoconfigured resource? My motivation for this is to be conservative about the public API surface area, and I struggled to think of reasons why you would want to access the resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My use-case is: I don't want to use the full auto-configure mechanisms because getting it right for my use-case is more trouble than just writing a few lines of java code to do it. But, I do want the auto-configured resource, since that's pretty simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trask Yes, indeed [at least to the conversation in that issue]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that #5554 is merged and there is a public API for obtaining the resource configured from environment variables / system properties, I've updated this PR to remove even the experimental accessor to get the autoconfigured resource.
With the new public API, I feel fairly strongly that any code accessing AutoConfiguredOpenTelemetrySdk.getResource()
shouldn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource configured from env vars != the full autoconfigured resource
I'm quite certain that we will continue to use the AutoConfiguredOpenTelemetrySdk#getResource()
method to get the full resource; we'll just have to move the reflection logic to our distro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, I don't want to block this issue on one vendor's complaints (some of which might disappear in the future, when we have a profiling signal and SDK); even more when we have a workaround for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource configured from env vars != the full autoconfigured resource
Correct. I'm torn on this. I'm ok with re-adding an internal method to continue accessing the full autoconfigured resource, but feel that long term, folks should work exclusively through the providers. I worry that keeping an internal method gives hope that someday accessing the full autoconfigured resource will become a public API, where in actuality I think its more likely to go away altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel that long term, folks should work exclusively through the providers.
Yeah, I totally agree with that. Long-term (or maybe even mid-term, once we have the profiling SDK) our (Splunk's) use cases will go away; and with #5554 implemented SDK users themselves should have no reason for that getResource()
method either.
I'm in favor of merging this PR as it is -- there are workaround that we can use in the Splunk distro; and the cause (stable autoconfigure module) is important enough.
Should resolve #5554 before merging this. |
…y-java into internalize-autoconfigure-methods
@@ -51,10 +51,10 @@ static AutoConfiguredOpenTelemetrySdk create( | |||
public abstract OpenTelemetrySdk getOpenTelemetrySdk(); | |||
|
|||
/** Returns the {@link Resource} that was auto-configured. */ | |||
public abstract Resource getResource(); | |||
abstract Resource getResource(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, I don't want to block this issue on one vendor's complaints (some of which might disappear in the future, when we have a profiling signal and SDK); even more when we have a workaround for that.
@jkwatson WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Related to #5464.
Moved AutoConfiguredOpenTelemetrySdk#getConfig() method to internal accessor to avoid backwards compatibility guarantees when we stabilize. Remove AutoConfiguredOpenTelemetrySdk#getResource() method.
**Edited 6/22 **