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

Fix gcp resource detection when using workload identity #10486

Merged
merged 1 commit into from
Jun 2, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

- `tanzuobservabilityexporter`: Improve how negative values in exponential histograms are handled. (#10135)
- `resourcedetectionprocessor`: GCP resource detector now properly detects zone/region on GKE (#10347)
- `resourcedetectionprocessor`: GCP resource detector no longer fails to detect resource when using workload identity (#10486)

## v0.52.0

Expand Down
1 change: 0 additions & 1 deletion processor/resourcedetectionprocessor/internal/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (d *detector) Detect(context.Context) (resource pcommon.Resource, schemaURL
b.addZoneOrRegion(d.detector.GKEAvailabilityZoneOrRegion)
b.add(conventions.AttributeK8SClusterName, d.detector.GKEClusterName)
b.add(conventions.AttributeHostID, d.detector.GKEHostID)
b.add(conventions.AttributeHostName, d.detector.GKEHostName)
case gcp.CloudRun:
b.attrs.InsertString(conventions.AttributeCloudPlatform, conventions.AttributeCloudPlatformGCPCloudRun)
b.add(conventions.AttributeFaaSName, d.detector.FaaSName)
Expand Down
12 changes: 0 additions & 12 deletions processor/resourcedetectionprocessor/internal/gcp/gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestDetect(t *testing.T) {
projectID: "my-project",
cloudPlatform: gcp.GKE,
gkeHostID: "1472385723456792345",
gkeHostName: "my-gke-node-1234",
gkeClusterName: "my-cluster",
gkeAvailabilityZone: "us-central1-c",
}},
Expand All @@ -57,7 +56,6 @@ func TestDetect(t *testing.T) {
conventions.AttributeK8SClusterName: "my-cluster",
conventions.AttributeCloudAvailabilityZone: "us-central1-c",
conventions.AttributeHostID: "1472385723456792345",
conventions.AttributeHostName: "my-gke-node-1234",
}),
},
{
Expand All @@ -66,7 +64,6 @@ func TestDetect(t *testing.T) {
projectID: "my-project",
cloudPlatform: gcp.GKE,
gkeHostID: "1472385723456792345",
gkeHostName: "my-gke-node-1234",
gkeClusterName: "my-cluster",
gkeRegion: "us-central1",
}},
Expand All @@ -77,7 +74,6 @@ func TestDetect(t *testing.T) {
conventions.AttributeK8SClusterName: "my-cluster",
conventions.AttributeCloudRegion: "us-central1",
conventions.AttributeHostID: "1472385723456792345",
conventions.AttributeHostName: "my-gke-node-1234",
}),
},
{
Expand Down Expand Up @@ -210,7 +206,6 @@ type fakeGCPDetector struct {
gkeRegion string
gkeClusterName string
gkeHostID string
gkeHostName string
faaSName string
faaSVersion string
faaSID string
Expand Down Expand Up @@ -262,13 +257,6 @@ func (f *fakeGCPDetector) GKEHostID() (string, error) {
return f.gkeHostID, nil
}

func (f *fakeGCPDetector) GKEHostName() (string, error) {
if f.err != nil {
return "", f.err
}
return f.gkeHostName, nil
}

func (f *fakeGCPDetector) FaaSName() (string, error) {
if f.err != nil {
return "", f.err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type gcpDetector interface {
GKEAvailabilityZoneOrRegion() (string, gcp.LocationType, error)
GKEClusterName() (string, error)
GKEHostID() (string, error)
GKEHostName() (string, error)
FaaSName() (string, error)
FaaSVersion() (string, error)
FaaSID() (string, error)
Expand Down