Socket
Book a DemoInstallSign in
Socket

@opentelemetry/resource-detector-gcp

Package Overview
Dependencies
Maintainers
3
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/resource-detector-gcp

OpenTelemetry SDK resource detector for GCP

0.37.0
latest
Source
npmnpm
Version published
Weekly downloads
2M
1.47%
Maintainers
3
Weekly downloads
 
Created
Source

OpenTelemetry Resource Detector for GCP

NPM Published Version Apache License

Resource detector for Google Cloud Platform.

Compatible with OpenTelemetry JS API and SDK 1.0+.

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 });

Available detectors

This package uses @opentelemetry/semantic-conventions version 1.22+, which implements Semantic Convention Version 1.7.0

GCP Detector

Resource AttributeDescription
cloud.account.idValue of project-id from GCP Metadata project
cloud.availability_zoneValue of zone from GCP Metadata instance
cloud.providerThe cloud provider. In this context, it's always "gcp"
container.nameValue of Environment Variable CONTAINER_NAME
host.idValue of id from GCP Metadata instance
host.nameValue of hostname from GCP Metadata instance
k8s.cluster.nameValue of attributes/cluster-name from GCP Metadata instance
k8s.namespace.nameValue of Environment Variable NAMESPACE
k8s.pod.nameValue of Environment Variable HOSTNAME

License

Apache 2.0 - See LICENSE for more information.

Keywords

opentelemetry

FAQs

Package last updated on 09 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.