diff --git a/detectors/node/opentelemetry-resource-detector-gcp/package.json b/detectors/node/opentelemetry-resource-detector-gcp/package.json index 6a3df59b58..cc070b0c5b 100644 --- a/detectors/node/opentelemetry-resource-detector-gcp/package.json +++ b/detectors/node/opentelemetry-resource-detector-gcp/package.json @@ -56,7 +56,7 @@ "dependencies": { "@opentelemetry/core": "^1.0.0", "@opentelemetry/resources": "^1.0.0", - "@opentelemetry/semantic-conventions": "^1.0.0", + "@opentelemetry/semantic-conventions": "^1.22.0", "gcp-metadata": "^6.0.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/detectors/node/opentelemetry-resource-detector-gcp#readme" diff --git a/detectors/node/opentelemetry-resource-detector-gcp/src/detectors/GcpDetector.ts b/detectors/node/opentelemetry-resource-detector-gcp/src/detectors/GcpDetector.ts index 206bb4d1d3..142885eaa6 100644 --- a/detectors/node/opentelemetry-resource-detector-gcp/src/detectors/GcpDetector.ts +++ b/detectors/node/opentelemetry-resource-detector-gcp/src/detectors/GcpDetector.ts @@ -24,8 +24,16 @@ import { } from '@opentelemetry/resources'; import { getEnv } from '@opentelemetry/core'; import { - CloudProviderValues, - SemanticResourceAttributes, + CLOUDPROVIDERVALUES_GCP, + SEMRESATTRS_CLOUD_ACCOUNT_ID, + SEMRESATTRS_CLOUD_AVAILABILITY_ZONE, + SEMRESATTRS_CLOUD_PROVIDER, + SEMRESATTRS_CONTAINER_NAME, + SEMRESATTRS_HOST_ID, + SEMRESATTRS_HOST_NAME, + SEMRESATTRS_K8S_CLUSTER_NAME, + SEMRESATTRS_K8S_NAMESPACE_NAME, + SEMRESATTRS_K8S_POD_NAME, } from '@opentelemetry/semantic-conventions'; /** @@ -58,12 +66,11 @@ class GcpDetector implements Detector { ]); const attributes: ResourceAttributes = {}; - attributes[SemanticResourceAttributes.CLOUD_ACCOUNT_ID] = projectId; - attributes[SemanticResourceAttributes.HOST_ID] = instanceId; - attributes[SemanticResourceAttributes.HOST_NAME] = hostname; - attributes[SemanticResourceAttributes.CLOUD_AVAILABILITY_ZONE] = zoneId; - attributes[SemanticResourceAttributes.CLOUD_PROVIDER] = - CloudProviderValues.GCP; + attributes[SEMRESATTRS_CLOUD_ACCOUNT_ID] = projectId; + attributes[SEMRESATTRS_HOST_ID] = instanceId; + attributes[SEMRESATTRS_HOST_NAME] = hostname; + attributes[SEMRESATTRS_CLOUD_AVAILABILITY_ZONE] = zoneId; + attributes[SEMRESATTRS_CLOUD_PROVIDER] = CLOUDPROVIDERVALUES_GCP; if (getEnv().KUBERNETES_SERVICE_HOST) this._addK8sAttributes(attributes, clusterName); @@ -78,10 +85,10 @@ class GcpDetector implements Detector { ): void { const env = getEnv(); - attributes[SemanticResourceAttributes.K8S_CLUSTER_NAME] = clusterName; - attributes[SemanticResourceAttributes.K8S_NAMESPACE_NAME] = env.NAMESPACE; - attributes[SemanticResourceAttributes.K8S_POD_NAME] = env.HOSTNAME; - attributes[SemanticResourceAttributes.CONTAINER_NAME] = env.CONTAINER_NAME; + attributes[SEMRESATTRS_K8S_CLUSTER_NAME] = clusterName; + attributes[SEMRESATTRS_K8S_NAMESPACE_NAME] = env.NAMESPACE; + attributes[SEMRESATTRS_K8S_POD_NAME] = env.HOSTNAME; + attributes[SEMRESATTRS_CONTAINER_NAME] = env.CONTAINER_NAME; } /** Gets project id from GCP project metadata. */ diff --git a/package-lock.json b/package-lock.json index eef1558af7..ba9b0c9ab0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -183,7 +183,7 @@ "dependencies": { "@opentelemetry/core": "^1.0.0", "@opentelemetry/resources": "^1.0.0", - "@opentelemetry/semantic-conventions": "^1.0.0", + "@opentelemetry/semantic-conventions": "^1.22.0", "gcp-metadata": "^6.0.0" }, "devDependencies": { @@ -48083,7 +48083,7 @@ "@opentelemetry/contrib-test-utils": "^0.38.0", "@opentelemetry/core": "^1.0.0", "@opentelemetry/resources": "^1.0.0", - "@opentelemetry/semantic-conventions": "^1.0.0", + "@opentelemetry/semantic-conventions": "^1.22.0", "@types/mocha": "8.2.3", "@types/node": "18.6.5", "@types/semver": "7.5.3",