Skip to content

Commit c3e2cf6

Browse files
committed
fix gcp resource detection when using workload identity
1 parent 04a92a2 commit c3e2cf6

File tree

4 files changed

+1
-14
lines changed

4 files changed

+1
-14
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

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

2829
## v0.52.0
2930

processor/resourcedetectionprocessor/internal/gcp/gcp.go

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func (d *detector) Detect(context.Context) (resource pcommon.Resource, schemaURL
6666
b.addZoneOrRegion(d.detector.GKEAvailabilityZoneOrRegion)
6767
b.add(conventions.AttributeK8SClusterName, d.detector.GKEClusterName)
6868
b.add(conventions.AttributeHostID, d.detector.GKEHostID)
69-
b.add(conventions.AttributeHostName, d.detector.GKEHostName)
7069
case gcp.CloudRun:
7170
b.attrs.InsertString(conventions.AttributeCloudPlatform, conventions.AttributeCloudPlatformGCPCloudRun)
7271
b.add(conventions.AttributeFaaSName, d.detector.FaaSName)

processor/resourcedetectionprocessor/internal/gcp/gcp_test.go

-12
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func TestDetect(t *testing.T) {
4646
projectID: "my-project",
4747
cloudPlatform: gcp.GKE,
4848
gkeHostID: "1472385723456792345",
49-
gkeHostName: "my-gke-node-1234",
5049
gkeClusterName: "my-cluster",
5150
gkeAvailabilityZone: "us-central1-c",
5251
}},
@@ -57,7 +56,6 @@ func TestDetect(t *testing.T) {
5756
conventions.AttributeK8SClusterName: "my-cluster",
5857
conventions.AttributeCloudAvailabilityZone: "us-central1-c",
5958
conventions.AttributeHostID: "1472385723456792345",
60-
conventions.AttributeHostName: "my-gke-node-1234",
6159
}),
6260
},
6361
{
@@ -66,7 +64,6 @@ func TestDetect(t *testing.T) {
6664
projectID: "my-project",
6765
cloudPlatform: gcp.GKE,
6866
gkeHostID: "1472385723456792345",
69-
gkeHostName: "my-gke-node-1234",
7067
gkeClusterName: "my-cluster",
7168
gkeRegion: "us-central1",
7269
}},
@@ -77,7 +74,6 @@ func TestDetect(t *testing.T) {
7774
conventions.AttributeK8SClusterName: "my-cluster",
7875
conventions.AttributeCloudRegion: "us-central1",
7976
conventions.AttributeHostID: "1472385723456792345",
80-
conventions.AttributeHostName: "my-gke-node-1234",
8177
}),
8278
},
8379
{
@@ -210,7 +206,6 @@ type fakeGCPDetector struct {
210206
gkeRegion string
211207
gkeClusterName string
212208
gkeHostID string
213-
gkeHostName string
214209
faaSName string
215210
faaSVersion string
216211
faaSID string
@@ -262,13 +257,6 @@ func (f *fakeGCPDetector) GKEHostID() (string, error) {
262257
return f.gkeHostID, nil
263258
}
264259

265-
func (f *fakeGCPDetector) GKEHostName() (string, error) {
266-
if f.err != nil {
267-
return "", f.err
268-
}
269-
return f.gkeHostName, nil
270-
}
271-
272260
func (f *fakeGCPDetector) FaaSName() (string, error) {
273261
if f.err != nil {
274262
return "", f.err

processor/resourcedetectionprocessor/internal/gcp/types.go

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ type gcpDetector interface {
2626
GKEAvailabilityZoneOrRegion() (string, gcp.LocationType, error)
2727
GKEClusterName() (string, error)
2828
GKEHostID() (string, error)
29-
GKEHostName() (string, error)
3029
FaaSName() (string, error)
3130
FaaSVersion() (string, error)
3231
FaaSID() (string, error)

0 commit comments

Comments
 (0)