From 54fc0f5915750b1ad1686379a2f1bc4460c83e91 Mon Sep 17 00:00:00 2001 From: James Luck Date: Sat, 7 Dec 2024 15:34:12 +1100 Subject: [PATCH] Running `make fmt` --- processor/tailsamplingprocessor/composite_helper.go | 3 ++- processor/tailsamplingprocessor/factory.go | 3 ++- .../internal/sampling/composite_test.go | 2 -- .../tailsamplingprocessor/internal/sampling/util_test.go | 7 +++++-- processor/tailsamplingprocessor/processor.go | 2 +- .../tailsamplingprocessor/processor_decisions_test.go | 3 ++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/processor/tailsamplingprocessor/composite_helper.go b/processor/tailsamplingprocessor/composite_helper.go index 511b4747d6ab..31819d22d1b2 100644 --- a/processor/tailsamplingprocessor/composite_helper.go +++ b/processor/tailsamplingprocessor/composite_helper.go @@ -4,9 +4,10 @@ package tailsamplingprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor" import ( - "github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor/internal/telemetry" "go.opentelemetry.io/collector/component" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor/internal/telemetry" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor/internal/sampling" ) diff --git a/processor/tailsamplingprocessor/factory.go b/processor/tailsamplingprocessor/factory.go index 979f963adea5..d9d6e04f0699 100644 --- a/processor/tailsamplingprocessor/factory.go +++ b/processor/tailsamplingprocessor/factory.go @@ -7,9 +7,10 @@ package tailsamplingprocessor // import "github.com/open-telemetry/opentelemetry import ( "context" - "github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor/internal/telemetry" "time" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor/internal/telemetry" + "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/processor" diff --git a/processor/tailsamplingprocessor/internal/sampling/composite_test.go b/processor/tailsamplingprocessor/internal/sampling/composite_test.go index 36b5bec81cef..562537acf555 100644 --- a/processor/tailsamplingprocessor/internal/sampling/composite_test.go +++ b/processor/tailsamplingprocessor/internal/sampling/composite_test.go @@ -90,7 +90,6 @@ func TestCompositeEvaluatorSampled(t *testing.T) { } func TestCompositeEvaluatorSampled_RecordSubPolicy(t *testing.T) { - // Create 2 subpolicies. First results in 100% NotSampled, the second in 100% Sampled. n1 := NewNumericAttributeFilter(componenttest.NewNopTelemetrySettings(), "tag", 0, 100, false) n2 := NewAlwaysSample(componenttest.NewNopTelemetrySettings()) @@ -183,7 +182,6 @@ func TestCompositeEvaluatorInverseSampled_AlwaysSampled(t *testing.T) { } func TestCompositeEvaluatorInverseSampled_AlwaysSampled_RecordSubPolicy(t *testing.T) { - // The first policy does not match, the second matches through invert n1 := NewStringAttributeFilter(componenttest.NewNopTelemetrySettings(), "tag", []string{"foo"}, false, 0, false) n2 := NewStringAttributeFilter(componenttest.NewNopTelemetrySettings(), "tag", []string{"foo"}, false, 0, true) diff --git a/processor/tailsamplingprocessor/internal/sampling/util_test.go b/processor/tailsamplingprocessor/internal/sampling/util_test.go index 7e41f1f46d96..016e3da44644 100644 --- a/processor/tailsamplingprocessor/internal/sampling/util_test.go +++ b/processor/tailsamplingprocessor/internal/sampling/util_test.go @@ -1,10 +1,14 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + package sampling import ( + "testing" + "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" - "testing" ) func TestSetAttrOnScopeSpans_Empty(t *testing.T) { @@ -17,7 +21,6 @@ func TestSetAttrOnScopeSpans_Empty(t *testing.T) { } func TestSetAttrOnScopeSpans_Many(t *testing.T) { - assertAttrExists := func(t *testing.T, attrs pcommon.Map, key string, value string) { v, ok := attrs.Get(key) assert.True(t, ok) diff --git a/processor/tailsamplingprocessor/processor.go b/processor/tailsamplingprocessor/processor.go index 46341bfa73b0..189d4be39141 100644 --- a/processor/tailsamplingprocessor/processor.go +++ b/processor/tailsamplingprocessor/processor.go @@ -59,7 +59,7 @@ type tailSamplingSpanProcessor struct { nonSampledIDCache cache.Cache[bool] deleteChan chan pcommon.TraceID numTracesOnMap *atomic.Uint64 - recordPolicy bool + recordPolicy bool } // spanAndScope a structure for holding information about span and its instrumentation scope. diff --git a/processor/tailsamplingprocessor/processor_decisions_test.go b/processor/tailsamplingprocessor/processor_decisions_test.go index 108544036ba0..0a69d7e25fc8 100644 --- a/processor/tailsamplingprocessor/processor_decisions_test.go +++ b/processor/tailsamplingprocessor/processor_decisions_test.go @@ -5,10 +5,11 @@ package tailsamplingprocessor import ( "context" - "github.com/stretchr/testify/assert" "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/consumer/consumertest"