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

Remove GKEHostName, since the instance name is not available on GKE #406

Merged
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
5 changes: 0 additions & 5 deletions detectors/gcp/gke.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ func (d *Detector) GKEHostID() (string, error) {
return d.GCEHostID()
}

// GKEHostName returns the instance name of the instance on which this program is running
func (d *Detector) GKEHostName() (string, error) {
return d.GCEHostName()
}

// GKEClusterName returns the name if the GKE cluster in which this program is running
func (d *Detector) GKEClusterName() (string, error) {
return d.metadata.InstanceAttributeValue(clusterNameMetadataAttr)
Expand Down
18 changes: 0 additions & 18 deletions detectors/gcp/gke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ func TestGKEHostIDErr(t *testing.T) {
assert.Equal(t, instanceID, "")
}

func TestGKEHostName(t *testing.T) {
d := NewTestDetector(&FakeMetadataProvider{
FakeInstanceName: "my-host-123",
}, &FakeOSProvider{})
hostName, err := d.GKEHostName()
assert.NoError(t, err)
assert.Equal(t, hostName, "my-host-123")
}

func TestGKEHostNameErr(t *testing.T) {
d := NewTestDetector(&FakeMetadataProvider{
Err: fmt.Errorf("fake error"),
}, &FakeOSProvider{})
hostName, err := d.GKEHostName()
assert.Error(t, err)
assert.Equal(t, hostName, "")
}

func TestGKEClusterName(t *testing.T) {
d := NewTestDetector(&FakeMetadataProvider{
InstanceAttributes: map[string]string{clusterNameMetadataAttr: "my-cluster"},
Expand Down
1 change: 0 additions & 1 deletion e2e-test-server/endtoendserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ func (d *testDetector) Detect(ctx context.Context) (*resource.Resource, error) {
return detectWithFuncs(attributes, map[attribute.Key]detectionFunc{
semconv.K8SClusterNameKey: detector.GKEClusterName,
semconv.HostIDKey: detector.GKEHostID,
semconv.HostNameKey: detector.GKEHostName,
})
case gcp.CloudRun:
attributes = append(attributes, semconv.CloudPlatformGCPCloudRun)
Expand Down