From 79c47319d7de5b07ee5e4214d7c6f74120f29860 Mon Sep 17 00:00:00 2001 From: Matthew Wear Date: Wed, 7 Oct 2020 17:09:10 -0700 Subject: [PATCH] chore: remove duplicate hostname resource attribute --- .../src/detectors/AwsEc2Detector.ts | 1 - packages/opentelemetry-resources/src/constants.ts | 6 ------ .../test/resource-assertions.test.ts | 1 - .../test/util/resource-assertions.ts | 5 ----- 4 files changed, 13 deletions(-) diff --git a/packages/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts b/packages/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts index 04342d91e8..6acd62e4ad 100644 --- a/packages/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts +++ b/packages/opentelemetry-resource-detector-aws/src/detectors/AwsEc2Detector.ts @@ -71,7 +71,6 @@ class AwsEc2Detector implements Detector { [HOST_RESOURCE.ID]: instanceId, [HOST_RESOURCE.TYPE]: instanceType, [HOST_RESOURCE.NAME]: hostname, - [HOST_RESOURCE.HOSTNAME]: hostname, }); } diff --git a/packages/opentelemetry-resources/src/constants.ts b/packages/opentelemetry-resources/src/constants.ts index 298241a1df..2317e864e1 100644 --- a/packages/opentelemetry-resources/src/constants.ts +++ b/packages/opentelemetry-resources/src/constants.ts @@ -47,12 +47,6 @@ export const CONTAINER_RESOURCE = { /** Attributes defining a computing instance (e.g. host). */ export const HOST_RESOURCE = { - /** - * Hostname of the host. It contains what the hostname command returns on the - * host machine. - */ - HOSTNAME: 'host.hostname', - /** * Unique host id. For Cloud this must be the instance_id assigned by the * cloud provider diff --git a/packages/opentelemetry-resources/test/resource-assertions.test.ts b/packages/opentelemetry-resources/test/resource-assertions.test.ts index 01952f3839..f0d20b67a3 100644 --- a/packages/opentelemetry-resources/test/resource-assertions.test.ts +++ b/packages/opentelemetry-resources/test/resource-assertions.test.ts @@ -89,7 +89,6 @@ describe('assertHostResource', () => { it('validates optional attributes', () => { const resource = new Resource({ - [HOST_RESOURCE.HOSTNAME]: 'opentelemetry-test-hostname', [HOST_RESOURCE.ID]: 'opentelemetry-test-id', [HOST_RESOURCE.NAME]: 'opentelemetry-test-name', [HOST_RESOURCE.TYPE]: 'n1-standard-1', diff --git a/packages/opentelemetry-resources/test/util/resource-assertions.ts b/packages/opentelemetry-resources/test/util/resource-assertions.ts index 4212058a03..e0fd11e974 100644 --- a/packages/opentelemetry-resources/test/util/resource-assertions.ts +++ b/packages/opentelemetry-resources/test/util/resource-assertions.ts @@ -122,11 +122,6 @@ export const assertHostResource = ( } ) => { assertHasOneLabel(HOST_RESOURCE, resource); - if (validations.hostName) - assert.strictEqual( - resource.attributes[HOST_RESOURCE.HOSTNAME], - validations.hostName - ); if (validations.id) assert.strictEqual(resource.attributes[HOST_RESOURCE.ID], validations.id); if (validations.name)