Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[resourcedetection] Unify gke and gce detectors and fix gke zone/region detection #10347

Merged
merged 1 commit into from
May 31, 2022
Merged
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## Unreleased

## 🛑 Breaking changes 🛑
### 🛑 Breaking changes 🛑

- `jmxreceiver`: Remove properties & groovyscript parameters from JMX Receiver. Add ResourceAttributes & LogLevel parameter to supply some of the removed functionality with reduced attack surface (#9685)
- `resourcedetectionprocessor`: 'gke' and 'gce' resource detectors are replaced with a single 'gcp' detector (#10347)

### 🚩 Deprecations 🚩

Expand All @@ -17,6 +20,7 @@
### 🧰 Bug fixes 🧰

- `tanzuobservabilityexporter`: Improve how negative values in exponential histograms are handled. (#10135)
- `resourcedetectionprocessor`: GCP resource detector now properly detects zone/region on GKE (#10347)

## v0.52.0

Expand Down
1 change: 1 addition & 0 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ require (
github.com/DataDog/datadog-go v4.8.2+incompatible // indirect
github.com/DataDog/sketches-go v1.4.1 // indirect
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v0.31.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector v0.30.2-0.20220512190557-875976f87023 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.6.1 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.30.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ require (
github.com/DataDog/datadog-go v4.8.2+incompatible // indirect
github.com/DataDog/sketches-go v1.4.1 // indirect
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v0.31.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector v0.30.2-0.20220512190557-875976f87023 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.6.1 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.30.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions processor/resourcedetectionprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/consul"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/docker"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/env"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/gcp/gce"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/gcp/gke"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/gcp"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/system"
)

Expand Down Expand Up @@ -69,8 +68,10 @@ func NewFactory() component.ProcessorFactory {
eks.TypeStr: eks.NewDetector,
elasticbeanstalk.TypeStr: elasticbeanstalk.NewDetector,
env.TypeStr: env.NewDetector,
gce.TypeStr: gce.NewDetector,
gke.TypeStr: gke.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,
})

Expand Down Expand Up @@ -201,6 +202,9 @@ 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)))
Expand Down
1 change: 1 addition & 0 deletions processor/resourcedetectionprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.17

require (
cloud.google.com/go/compute v1.6.1
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v0.31.0
github.com/Showmax/go-fqdn v1.0.0
github.com/aws/aws-sdk-go v1.44.20
github.com/census-instrumentation/opencensus-proto v0.3.0
Expand Down
2 changes: 2 additions & 0 deletions processor/resourcedetectionprocessor/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 0 additions & 105 deletions processor/resourcedetectionprocessor/internal/gcp/gce/gce.go

This file was deleted.

103 changes: 0 additions & 103 deletions processor/resourcedetectionprocessor/internal/gcp/gce/gce_test.go

This file was deleted.

Loading