diff --git a/processor/resourcedetectionprocessor/factory.go b/processor/resourcedetectionprocessor/factory.go index eeac96506069..f0f38890edff 100644 --- a/processor/resourcedetectionprocessor/factory.go +++ b/processor/resourcedetectionprocessor/factory.go @@ -71,9 +71,6 @@ func NewFactory() processor.Factory { elasticbeanstalk.TypeStr: elasticbeanstalk.NewDetector, env.TypeStr: env.NewDetector, gcp.TypeStr: gcp.NewDetector, - // TODO(#10348): Remove GKE and GCE after the v0.54.0 release. - gcp.DeprecatedGKETypeStr: gcp.NewDetector, - gcp.DeprecatedGCETypeStr: gcp.NewDetector, system.TypeStr: system.NewDetector, }) @@ -208,9 +205,6 @@ func (f *factory) getResourceProvider( return provider, nil } - // TODO(#10348): Remove this after the v0.54.0 release. - configuredDetectors = gcp.DeduplicateDetectors(params, configuredDetectors) - detectorTypes := make([]internal.DetectorType, 0, len(configuredDetectors)) for _, key := range configuredDetectors { detectorTypes = append(detectorTypes, internal.DetectorType(strings.TrimSpace(key))) diff --git a/processor/resourcedetectionprocessor/internal/gcp/gcp.go b/processor/resourcedetectionprocessor/internal/gcp/gcp.go index e6aa7b3f1d08..699a4954e8f7 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/gcp.go +++ b/processor/resourcedetectionprocessor/internal/gcp/gcp.go @@ -32,10 +32,6 @@ import ( const ( // TypeStr is type of detector. TypeStr = "gcp" - // 'gke' and 'gce' detectors are replaced with the unified 'gcp' detector - // TODO(#10348): Remove these after the v0.54.0 release. - DeprecatedGKETypeStr = "gke" - DeprecatedGCETypeStr = "gce" ) // NewDetector returns a detector which can detect resource attributes on: @@ -164,31 +160,3 @@ func (r *resourceBuilder) addZoneOrRegion(detect func() (string, gcp.LocationTyp r.errs = append(r.errs, fmt.Errorf("location must be zone or region. Got %v", locType)) } } - -// DeduplicateDetectors ensures only one of ['gcp','gke','gce'] are present in -// the list of detectors. Currently, users configure both GCE and GKE detectors -// when running on GKE. Resource merge would fail in this case if we don't -// deduplicate, which would break users. -// TODO(#10348): Remove this function after the v0.54.0 release. -func DeduplicateDetectors(set processor.CreateSettings, detectors []string) []string { - var out []string - var found bool - for _, d := range detectors { - switch d { - case DeprecatedGKETypeStr: - set.Logger.Warn("The 'gke' detector is deprecated. Use the 'gcp' detector instead.") - case DeprecatedGCETypeStr: - set.Logger.Warn("The 'gce' detector is deprecated. Use the 'gcp' detector instead.") - case TypeStr: - default: - out = append(out, d) - continue - } - // ensure we only keep the first GCP detector we find. - if !found { - found = true - out = append(out, d) - } - } - return out -} diff --git a/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go b/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go index c6c57c1a4e58..06a97958d4c1 100644 --- a/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go +++ b/processor/resourcedetectionprocessor/internal/gcp/gcp_test.go @@ -21,7 +21,6 @@ import ( "github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/collector/processor/processortest" conventions "go.opentelemetry.io/collector/semconv/v1.6.1" "go.uber.org/zap" @@ -403,46 +402,3 @@ func (f *fakeGCPDetector) GCEHostName() (string, error) { } return f.gceHostName, f.gceHostNameErr } - -func TestDeduplicateDetectors(t *testing.T) { - for _, tc := range []struct { - desc string - in []string - expected []string - }{ - { - desc: "empty", - expected: nil, - }, - { - desc: "single gcp", - in: []string{"gcp"}, - expected: []string{"gcp"}, - }, - { - desc: "single gce", - in: []string{"gce"}, - expected: []string{"gce"}, - }, - { - desc: "single gke", - in: []string{"gke"}, - expected: []string{"gke"}, - }, - { - desc: "multi", - in: []string{"gcp", "gce", "gke"}, - expected: []string{"gcp"}, - }, - { - desc: "multi with others", - in: []string{"foo", "gcp", "gce", "bar", "gke"}, - expected: []string{"foo", "gcp", "bar"}, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - out := DeduplicateDetectors(processortest.NewNopCreateSettings(), tc.in) - assert.Equal(t, tc.expected, out) - }) - } -}