npm.io
0.55.0 • Published 2 weeks ago

@opentelemetry/resource-detector-gcp

Licence
Apache-2.0
Version
0.55.0
Deps
3
Size
170 kB
Vulns
0
Weekly
0
Stars
915

OpenTelemetry Resource Detector for GCP

NPM Published Version Apache License

Resource detector for Google Cloud Platform.

Compatible with OpenTelemetry JS API 1.0+ and SDK 2.0+.

Installation

npm install --save @opentelemetry/resource-detector-gcp

Usage

import { detectResources } from '@opentelemetry/resources';
import { gcpDetector } from '@opentelemetry/resource-detector-gcp'
const resource = await detectResources({
   detectors: [gcpDetector],
})

const tracerProvider = new NodeTracerProvider({ resource });

Available detectors

This package implements Semantic Convention Version 1.39.0

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 (parsed from full path).
cloud.platform The GCP platform where the application is running.
cloud.provider The cloud provider. In this context, it's always gcp
cloud.region Value of region from GCP Metadata instance (parsed from full path).
faas.instance Value of id from GCP Metadata instance.
faas.name Value of Environment Variable K_SERVICE.
faas.version Value of Environment Variable K_REVISION.
host.id Value of id from GCP Metadata instance.
host.name Value of name from GCP Metadata instance.
host.type Value of machine-type from GCP Metadata instance.
k8s.cluster.name Value of attributes/cluster-name from GCP Metadata instance.

License

Apache 2.0 - See LICENSE for more information.

Keywords