@opentelemetry/resource-detector-gcp
Advanced tools
Comparing version 0.29.8 to 0.29.9
@@ -51,8 +51,7 @@ "use strict"; | ||
const attributes = {}; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.CLOUD_ACCOUNT_ID] = projectId; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.HOST_ID] = instanceId; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.HOST_NAME] = hostname; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.CLOUD_AVAILABILITY_ZONE] = zoneId; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.CLOUD_PROVIDER] = | ||
semantic_conventions_1.CloudProviderValues.GCP; | ||
attributes[semantic_conventions_1.SEMRESATTRS_CLOUD_ACCOUNT_ID] = projectId; | ||
attributes[semantic_conventions_1.SEMRESATTRS_HOST_ID] = instanceId; | ||
attributes[semantic_conventions_1.SEMRESATTRS_HOST_NAME] = hostname; | ||
attributes[semantic_conventions_1.SEMRESATTRS_CLOUD_AVAILABILITY_ZONE] = zoneId; | ||
attributes[semantic_conventions_1.SEMRESATTRS_CLOUD_PROVIDER] = semantic_conventions_1.CLOUDPROVIDERVALUES_GCP; | ||
if ((0, core_1.getEnv)().KUBERNETES_SERVICE_HOST) | ||
@@ -65,6 +64,6 @@ this._addK8sAttributes(attributes, clusterName); | ||
const env = (0, core_1.getEnv)(); | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.K8S_CLUSTER_NAME] = clusterName; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.K8S_NAMESPACE_NAME] = env.NAMESPACE; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.K8S_POD_NAME] = env.HOSTNAME; | ||
attributes[semantic_conventions_1.SemanticResourceAttributes.CONTAINER_NAME] = env.CONTAINER_NAME; | ||
attributes[semantic_conventions_1.SEMRESATTRS_K8S_CLUSTER_NAME] = clusterName; | ||
attributes[semantic_conventions_1.SEMRESATTRS_K8S_NAMESPACE_NAME] = env.NAMESPACE; | ||
attributes[semantic_conventions_1.SEMRESATTRS_K8S_POD_NAME] = env.HOSTNAME; | ||
attributes[semantic_conventions_1.SEMRESATTRS_CONTAINER_NAME] = env.CONTAINER_NAME; | ||
} | ||
@@ -71,0 +70,0 @@ /** Gets project id from GCP project metadata. */ |
{ | ||
"name": "@opentelemetry/resource-detector-gcp", | ||
"version": "0.29.8", | ||
"version": "0.29.9", | ||
"description": "OpenTelemetry SDK resource detector for GCP", | ||
@@ -42,3 +42,3 @@ "main": "build/src/index.js", | ||
"@opentelemetry/api": "^1.0.0", | ||
"@opentelemetry/contrib-test-utils": "^0.38.0", | ||
"@opentelemetry/contrib-test-utils": "^0.39.0", | ||
"@types/mocha": "8.2.3", | ||
@@ -60,7 +60,7 @@ "@types/node": "18.6.5", | ||
"@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", | ||
"gitHead": "17a0bc1da3baa472ba9b867eee3c60730cc130fb" | ||
"gitHead": "96a87b48934f0afcf1fe637eed6704f35bd8e973" | ||
} |
@@ -30,2 +30,20 @@ # OpenTelemetry Resource Detector for GCP | ||
## Available detectors | ||
This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) | ||
### GCP Detector | ||
| Resource Attribute | Description | | ||
|-------------------------|---------------------------------------------------------------| | ||
| cloud.account.id | Value of `project-id` from GCP Metadata project | | ||
| cloud.availability_zone | Value of `zone` from GCP Metadata instance | | ||
| cloud.provider | The cloud provider. In this context, it's always "gcp" | | ||
| container.name | Value of Environment Variable `CONTAINER_NAME` | | ||
| host.id | Value of `id` from GCP Metadata instance | | ||
| host.name | Value of `hostname` from GCP Metadata instance | | ||
| k8s.cluster.name | Value of `attributes/cluster-name` from GCP Metadata instance | | ||
| k8s.namespace.name | Value of Environment Variable `NAMESPACE` | | ||
| k8s.pod.name | Value of Environment Variable `HOSTNAME` | | ||
## Useful links | ||
@@ -32,0 +50,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
34124
66
213