-
Notifications
You must be signed in to change notification settings - Fork 850
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 ComponentLoader to support more auto configuration scenarios #6217
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0531869
add ComponentLoader to support more auto configuration scenarios, e.g…
zeitlinger 6d51896
format
zeitlinger 2b9fb28
add loadOptional
zeitlinger e1352d6
customizers are sufficient
zeitlinger 091b19b
ExemplarFilter is going to be removed from public API, so don't expos…
zeitlinger eac57ca
customizers are sufficient
zeitlinger ae2c633
add exception for jcmpapi
zeitlinger 2bec27f
jcmpapi
zeitlinger ad4047f
test component loader is used
zeitlinger 5336d59
Revert "customizers are sufficient"
zeitlinger 44df716
add loader for ConfigProperties
zeitlinger 74322cd
Revert "add loader for ConfigProperties"
zeitlinger 5799589
Revert "Revert "customizers are sufficient""
zeitlinger 3f574fb
add loader for ConfigProperties
zeitlinger 6d06755
make component loader internal to give it time to incubate
zeitlinger 42d6e17
remove ConfigurableProvider
zeitlinger d03a67f
add javadoc
zeitlinger 517d773
make new methods experimental
zeitlinger e97c4f9
don't make loadOrdered overridable
zeitlinger 4519a7e
add setConfigPropertiesCustomizer
zeitlinger 22996e0
add setConfigPropertiesCustomizer
zeitlinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,21 +173,13 @@ static Sampler configureSampler(String sampler, ConfigProperties config, SpiHelp | |
case "always_off": | ||
return Sampler.alwaysOff(); | ||
case "traceidratio": | ||
{ | ||
double ratio = | ||
config.getDouble("otel.traces.sampler.arg", DEFAULT_TRACEIDRATIO_SAMPLE_RATIO); | ||
return Sampler.traceIdRatioBased(ratio); | ||
} | ||
return ratioSampler(config); | ||
case PARENTBASED_ALWAYS_ON: | ||
return Sampler.parentBased(Sampler.alwaysOn()); | ||
case "parentbased_always_off": | ||
return Sampler.parentBased(Sampler.alwaysOff()); | ||
case "parentbased_traceidratio": | ||
{ | ||
double ratio = | ||
config.getDouble("otel.traces.sampler.arg", DEFAULT_TRACEIDRATIO_SAMPLE_RATIO); | ||
return Sampler.parentBased(Sampler.traceIdRatioBased(ratio)); | ||
} | ||
return Sampler.parentBased(ratioSampler(config)); | ||
Comment on lines
-186
to
+182
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a nice change, but seems unrelated to this PR? in the future splitting out unrelated changes can make life easier for reviewers |
||
case "parentbased_jaeger_remote": | ||
Sampler jaegerRemote = spiSamplersManager.getByName("jaeger_remote"); | ||
if (jaegerRemote == null) { | ||
|
@@ -205,5 +197,10 @@ static Sampler configureSampler(String sampler, ConfigProperties config, SpiHelp | |
} | ||
} | ||
|
||
private static Sampler ratioSampler(ConfigProperties config) { | ||
double ratio = config.getDouble("otel.traces.sampler.arg", DEFAULT_TRACEIDRATIO_SAMPLE_RATIO); | ||
return Sampler.traceIdRatioBased(ratio); | ||
} | ||
|
||
private TracerProviderConfiguration() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...oconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/internal/ComponentLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.sdk.autoconfigure.internal; | ||
|
||
/** | ||
* A loader for components that are discovered via SPI. | ||
* | ||
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change | ||
* at any time. | ||
*/ | ||
public interface ComponentLoader { | ||
/** | ||
* Load implementations of an SPI. | ||
* | ||
* @param spiClass the SPI class | ||
* @param <T> the SPI type | ||
* @return iterable of SPI implementations | ||
*/ | ||
<T> Iterable<T> load(Class<T> spiClass); | ||
zeitlinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't need this anymore.
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.
not for this PR - but it's still true that jApiCmp will trip over generics - I'm fine to take it out, of course.