OpenTelemetry Resource Detector for GCP
The OpenTelemetry Resource is an immutable representation of the entity producing telemetry. For example, a process producing telemetry that is running in a container on Kubernetes has a Pod name, it is in a namespace and possibly is part of a Deployment which also has a name. All three of these attributes can be included in the Resource
.
This document defines standard attributes for resources.
Installation
The GCP resource detector requires Node.JS 10+ due to a dependency on gcp-metadata
which uses features only available in Node.JS 10+.
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 });
Useful links
License
Apache 2.0 - See LICENSE for more information.