Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Set `error.type` attribute instead of adding `exception` span events in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#8386)
- Set `error.type` attribute instead of adding `exception` span events in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws`. (#8386)

### Deprecated

- The `samplers/probability/consistent` package is deprecated and will be removed in a future release in `go.opentelemetry.io/contrib/samplers/probability`. (#8447)

<!-- Released section -->
<!-- Don't change this section unless doing release -->

Expand Down
14 changes: 14 additions & 0 deletions samplers/probability/consistent/sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
// SPDX-License-Identifier: Apache-2.0

// Package consistent provides a consistent probability based sampler.
//
// Deprecated: This entire package is obsolete and based on a removed
// experimental specification (opentelemetry-specification#4673).
// It will be removed in a future release.
// See open-telemetry/opentelemetry-go#7485 for the replacement.
package consistent // import "go.opentelemetry.io/contrib/samplers/probability/consistent"

import (
Expand All @@ -15,6 +20,7 @@ import (
"go.opentelemetry.io/otel/trace"
)

// Deprecated: This package is obsolete.
type (
// ProbabilityBasedOption is an option to the
// ConssitentProbabilityBased sampler.
Expand Down Expand Up @@ -54,6 +60,8 @@ type (
)

// WithRandomSource sets the source of the randomness used by the Sampler.
//
// Deprecated: This package is obsolete.
func WithRandomSource(source rand.Source) ProbabilityBasedOption {
return consistentProbabilityBasedRandomSource{source}
}
Expand All @@ -73,6 +81,8 @@ func (s consistentProbabilityBasedRandomSource) apply(cfg *consistentProbability
//
// To respect the parent trace's `SampledFlag`, this sampler should be
// used as the root delegate of a `Parent` sampler.
//
// Deprecated: This package is obsolete.
func ProbabilityBased(fraction float64, opts ...ProbabilityBasedOption) sdktrace.Sampler {
cfg := consistentProbabilityBasedConfig{
source: rand.NewSource(rand.Int63()), //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand) is ignored as this is not security-sensitive.
Expand Down Expand Up @@ -110,6 +120,8 @@ func (cs *consistentProbabilityBased) lowChoice() bool {
}

// ShouldSample implements "go.opentelemetry.io/otel/sdk/trace".Sampler.
//
// Deprecated: This package is obsolete.
func (cs *consistentProbabilityBased) ShouldSample(p sdktrace.SamplingParameters) sdktrace.SamplingResult {
psc := trace.SpanContextFromContext(p.ParentContext)

Expand Down Expand Up @@ -158,6 +170,8 @@ func (cs *consistentProbabilityBased) ShouldSample(p sdktrace.SamplingParameters
}

// Description returns "ProbabilityBased{%g}" with the configured probability.
//
// Deprecated: This package is obsolete.
func (cs *consistentProbabilityBased) Description() string {
var prob float64
if cs.lowLAC != pZeroValue {
Expand Down