Skip to content

Commit

Permalink
fix(opencensus): rename to takeParentDecision
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianccm committed Jul 18, 2024
1 parent 7afaa6a commit 78fd979
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions framework/opencensus/sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
//
// If the whitelist is empty it is treated as allowed, otherwise checked first.
// If the blacklist is set it will disable sampling again.
// If takeParentDecision is set we allow the decision to be taken from incoming tracing,
// If ignoreParentDecision is set we allow the decision to be taken from incoming tracing,
// otherwise we enforce our decision
func URLPrefixSampler(allowed, blocked []string, allowParentTrace bool) func(*http.Request) trace.StartOptions {
func URLPrefixSampler(allowed, blocked []string, ignoreParentDecision bool) func(*http.Request) trace.StartOptions {
return func(request *http.Request) trace.StartOptions {

path := request.URL.Path
Expand All @@ -33,7 +33,7 @@ func URLPrefixSampler(allowed, blocked []string, allowParentTrace bool) func(*ht
if !sample {
return trace.StartOptions{
Sampler: func(p trace.SamplingParameters) trace.SamplingDecision {
return trace.SamplingDecision{Sample: !allowParentTrace && p.ParentContext.IsSampled()}
return trace.SamplingDecision{Sample: !ignoreParentDecision && p.ParentContext.IsSampled()}
},
}
}
Expand All @@ -49,7 +49,7 @@ func URLPrefixSampler(allowed, blocked []string, allowParentTrace bool) func(*ht
// we sample, or the parent sampled
return trace.StartOptions{
Sampler: func(p trace.SamplingParameters) trace.SamplingDecision {
return trace.SamplingDecision{Sample: (!allowParentTrace && p.ParentContext.IsSampled()) || sample}
return trace.SamplingDecision{Sample: (!ignoreParentDecision && p.ParentContext.IsSampled()) || sample}
},
}
}
Expand Down

0 comments on commit 78fd979

Please sign in to comment.