diff --git a/api/trace/never_sampler.go b/api/trace/always_off_sampler.go similarity index 73% rename from api/trace/never_sampler.go rename to api/trace/always_off_sampler.go index 6438a1109b2..0245a3144a2 100644 --- a/api/trace/never_sampler.go +++ b/api/trace/always_off_sampler.go @@ -19,17 +19,17 @@ import ( ) const ( - neverSamplerDescription = "NeverSampleSampler" + alwaysOffSamplerDescription = "AlwaysOffSampler" ) -var neverSampledecision = Decision{Sampled: false} +var alwaysOffSamplerDecision = Decision{Sampled: false} -type neverSampleSampler struct{} +type alwaysOffSampler struct{} // ShouldSample implements Sampler interface. // It always returns a Decision with Sampled value set to false // and with Attributes set to an empty slice. -func (ns neverSampleSampler) ShouldSample( +func (ns alwaysOffSampler) ShouldSample( _ core.SpanContext, _ bool, _ core.TraceID, @@ -39,17 +39,17 @@ func (ns neverSampleSampler) ShouldSample( _ []core.KeyValue, _ []Link, ) Decision { - return neverSampledecision + return alwaysOffSamplerDecision } // Description implements Sampler interface. // It returns the description of this sampler. -func (ns neverSampleSampler) Description() string { - return neverSamplerDescription +func (ns alwaysOffSampler) Description() string { + return alwaysOffSamplerDescription } -var _ Sampler = neverSampleSampler{} +var _ Sampler = alwaysOffSampler{} -func NeverSampleSampler() Sampler { - return neverSampleSampler{} +func AlwaysOffSampler() Sampler { + return alwaysOffSampler{} } diff --git a/api/trace/never_sampler_test.go b/api/trace/always_off_sampler_test.go similarity index 85% rename from api/trace/never_sampler_test.go rename to api/trace/always_off_sampler_test.go index 84cfbd6e4aa..b47bfb0f1d0 100644 --- a/api/trace/never_sampler_test.go +++ b/api/trace/always_off_sampler_test.go @@ -23,7 +23,7 @@ import ( ) func TestNeverSamperShouldSample(t *testing.T) { - gotD := NeverSampleSampler().ShouldSample( + gotD := AlwaysOffSampler().ShouldSample( core.SpanContext{}, false, core.TraceID{}, core.SpanID{}, "span", SpanKindClient, []core.KeyValue{}, []Link{}) wantD := Decision{Sampled: false} if diff := cmp.Diff(wantD, gotD); diff != "" { @@ -31,9 +31,9 @@ func TestNeverSamperShouldSample(t *testing.T) { } } -func TestNeverSamplerDescription(t *testing.T) { - gotDesc := NeverSampleSampler().Description() - wantDesc := neverSamplerDescription +func TestAlwaysOffSamplerDescription(t *testing.T) { + gotDesc := AlwaysOffSampler().Description() + wantDesc := alwaysOffSamplerDescription if diff := cmp.Diff(wantDesc, gotDesc); diff != "" { t.Errorf("Description: +got, -want%v", diff) } diff --git a/api/trace/always_sampler.go b/api/trace/always_on_sampler.go similarity index 72% rename from api/trace/always_sampler.go rename to api/trace/always_on_sampler.go index 8b4a3dab220..ac1107a631e 100644 --- a/api/trace/always_sampler.go +++ b/api/trace/always_on_sampler.go @@ -19,17 +19,17 @@ import ( ) const ( - alwaysSamplerDescription = "AlwaysSampleSampler" + alwaysOnSamplerDescription = "AlwaysOnSampler" ) -var alwaysSampleDecision = Decision{Sampled: true} +var alwaysOnSamplerDecision = Decision{Sampled: true} -type alwaysSampleSampler struct{} +type alwaysOnSampler struct{} // ShouldSample implements Sampler interface. // It always returns a Decision with Sampled value set to true // and with Attributes set to an empty slice. -func (as alwaysSampleSampler) ShouldSample( +func (as alwaysOnSampler) ShouldSample( _ core.SpanContext, _ bool, _ core.TraceID, @@ -39,17 +39,17 @@ func (as alwaysSampleSampler) ShouldSample( _ []core.KeyValue, _ []Link, ) Decision { - return alwaysSampleDecision + return alwaysOnSamplerDecision } // Description implements Sampler interface. // It returns the description of this sampler. -func (as alwaysSampleSampler) Description() string { - return alwaysSamplerDescription +func (as alwaysOnSampler) Description() string { + return alwaysOnSamplerDescription } -var _ Sampler = alwaysSampleSampler{} +var _ Sampler = alwaysOnSampler{} -func AlwaysSampleSampler() Sampler { - return alwaysSampleSampler{} +func AlwaysOnSampler() Sampler { + return alwaysOnSampler{} } diff --git a/api/trace/always_sampler_test.go b/api/trace/always_on_sampler_test.go similarity index 82% rename from api/trace/always_sampler_test.go rename to api/trace/always_on_sampler_test.go index 4e13499a763..655eb9fd33d 100644 --- a/api/trace/always_sampler_test.go +++ b/api/trace/always_on_sampler_test.go @@ -22,8 +22,8 @@ import ( "go.opentelemetry.io/otel/api/core" ) -func TestShouldSample(t *testing.T) { - gotD := AlwaysSampleSampler().ShouldSample( +func TestAlwaysOnSamplerShouldSample(t *testing.T) { + gotD := AlwaysOnSampler().ShouldSample( core.SpanContext{}, false, core.TraceID{}, core.SpanID{}, "span", SpanKindClient, []core.KeyValue{}, []Link{}) wantD := Decision{Sampled: true} if diff := cmp.Diff(wantD, gotD); diff != "" { @@ -31,9 +31,9 @@ func TestShouldSample(t *testing.T) { } } -func TestDescription(t *testing.T) { - gotDesc := AlwaysSampleSampler().Description() - wantDesc := alwaysSamplerDescription +func TestAlwaysOnSamplerDescription(t *testing.T) { + gotDesc := AlwaysOnSampler().Description() + wantDesc := alwaysOnSamplerDescription if diff := cmp.Diff(wantDesc, gotDesc); diff != "" { t.Errorf("Description: +got, -want%v", diff) } diff --git a/sdk/trace/sampling.go b/sdk/trace/sampling.go index b19fa763db3..20c2e36f040 100644 --- a/sdk/trace/sampling.go +++ b/sdk/trace/sampling.go @@ -79,7 +79,7 @@ func (ps probabilitySampler) Description() string { // ProbabilitySampler samples a given fraction of traces. Fractions >= 1 will // always sample. If the parent span is sampled, then it's child spans will -// automatically be sampled. Fractions <0 are treated as zero, but spans may +// automatically be sampled. Fractions < 0 are treated as zero, but spans may // still be sampled if their parent is. func ProbabilitySampler(fraction float64) Sampler { if fraction >= 1 {