Skip to content

Commit

Permalink
[resourcedetection] Unify gke and gce detectors and fix gke zone/regi…
Browse files Browse the repository at this point in the history
…on detection (open-telemetry#10347)

resourcedetectionprocessor: unify gke and gce detectors and fix gke zone/region detection
  • Loading branch information
dashpole authored and kentquirk committed Jun 13, 2022
1 parent 8f8f80a commit bcd8a58
Show file tree
Hide file tree
Showing 20 changed files with 631 additions and 620 deletions.
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)

- `pkg/stanza`: Removed reference to deprecated `ClusterName` (#10426)

Expand All @@ -19,6 +22,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.24
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

0 comments on commit bcd8a58

Please sign in to comment.