forked from open-telemetry/opentelemetry-java-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a provider for consistent parent based probability sampler (open-…
- Loading branch information
1 parent
a7d3297
commit f71241d
Showing
3 changed files
with
27 additions
and
0 deletions.
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
25 changes: 25 additions & 0 deletions
25
...telemetry/contrib/sampler/consistent/ParentBasedConsistentProbabilitySamplerProvider.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,25 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.contrib.sampler.consistent; | ||
|
||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; | ||
import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider; | ||
import io.opentelemetry.sdk.trace.samplers.Sampler; | ||
|
||
public final class ParentBasedConsistentProbabilitySamplerProvider | ||
implements ConfigurableSamplerProvider { | ||
|
||
@Override | ||
public Sampler createSampler(ConfigProperties config) { | ||
double samplingProbability = config.getDouble("otel.traces.sampler.arg", 1.0d); | ||
return ConsistentSampler.parentBased(ConsistentSampler.probabilityBased(samplingProbability)); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "parentbased_consistent_probability"; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...TA-INF/services/io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider
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 @@ | ||
io.opentelemetry.contrib.sampler.consistent.ParentBasedConsistentProbabilitySamplerProvider |