You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-25 22:41:46 +02:00
revent end-users from implementing some interfaces (#1575)
"otel/exporters/otlp/otlphttp".Option "otel/exporters/stdout".Option "otel/oteltest".Option "otel/trace".TracerOption "otel/trace".SpanOption "otel/trace".EventOption "otel/trace".LifeCycleOption "otel/trace".InstrumentationOption "otel/sdk/resource".Option "otel/sdk/trace".ParentBasedSamplerOption "otel/sdk/trace".ReadOnlySpan "otel/sdk/trace".ReadWriteSpan Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
@@ -190,6 +190,11 @@ type config struct {
|
||||
// ParentBasedSamplerOption configures the sampler for a particular sampling case.
|
||||
type ParentBasedSamplerOption interface {
|
||||
Apply(*config)
|
||||
|
||||
// A private method to prevent users implementing the
|
||||
// interface and so future additions to it will not
|
||||
// violate compatibility.
|
||||
private()
|
||||
}
|
||||
|
||||
// WithRemoteParentSampled sets the sampler for the case of sampled remote parent.
|
||||
@@ -205,6 +210,8 @@ func (o remoteParentSampledOption) Apply(config *config) {
|
||||
config.remoteParentSampled = o.s
|
||||
}
|
||||
|
||||
func (remoteParentSampledOption) private() {}
|
||||
|
||||
// WithRemoteParentNotSampled sets the sampler for the case of remote parent
|
||||
// which is not sampled.
|
||||
func WithRemoteParentNotSampled(s Sampler) ParentBasedSamplerOption {
|
||||
@@ -219,6 +226,8 @@ func (o remoteParentNotSampledOption) Apply(config *config) {
|
||||
config.remoteParentNotSampled = o.s
|
||||
}
|
||||
|
||||
func (remoteParentNotSampledOption) private() {}
|
||||
|
||||
// WithLocalParentSampled sets the sampler for the case of sampled local parent.
|
||||
func WithLocalParentSampled(s Sampler) ParentBasedSamplerOption {
|
||||
return localParentSampledOption{s}
|
||||
@@ -232,6 +241,8 @@ func (o localParentSampledOption) Apply(config *config) {
|
||||
config.localParentSampled = o.s
|
||||
}
|
||||
|
||||
func (localParentSampledOption) private() {}
|
||||
|
||||
// WithLocalParentNotSampled sets the sampler for the case of local parent
|
||||
// which is not sampled.
|
||||
func WithLocalParentNotSampled(s Sampler) ParentBasedSamplerOption {
|
||||
@@ -246,6 +257,8 @@ func (o localParentNotSampledOption) Apply(config *config) {
|
||||
config.localParentNotSampled = o.s
|
||||
}
|
||||
|
||||
func (localParentNotSampledOption) private() {}
|
||||
|
||||
func (pb parentBased) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
if p.ParentContext.IsValid() {
|
||||
if p.HasRemoteParent {
|
||||
|
||||
Reference in New Issue
Block a user