npm.io
0.32.0 • Published 7 months ago

@opentelemetry/resource-detector-github

Licence
Apache-2.0
Version
0.32.0
Deps
1
Size
32 kB
Vulns
0
Weekly
0
Stars
916

OpenTelemetry Resource Detector for GitHub Actions

NPM Published Version Apache License

Resource detector for GitHub Actions.

Detects GITHUB_* environment variables specified here and adds as attributes on a resource.

This is useful for collecting telemetry in GitHub Actions-powered CI/CD workflows.

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.

Compatible with OpenTelemetry JS API and SDK 1.0+.

Installation

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

Usage

const { gitHubDetector } = require('@opentelemetry/resource-detector-github')

async function run() {
  // Initialize GitHub Resource Detector
  const resource = await gitHubDetector.detect();
};

run()

Available detectors

GitHub Detector
Resource Attribute Description
github.actor Value of Process Environment Variable GITHUB_ACTOR
github.base_ref Value of Process Environment Variable GITHUB_BASE_REF
github.head_ref Value of Process Environment Variable GITHUB_HEAD_REF
github.ref Value of Process Environment Variable GITHUB_REF
github.run_id Value of Process Environment Variable GITHUB_RUN_ID
github.run_number Value of Process Environment Variable GITHUB_RUN_NUMBER
github.sha Value of Process Environment Variable GITHUB_SHA
github.workflow Value of Process Environment Variable GITHUB_WORKFLOW

License

Apache 2.0 - See LICENSE for more information.

Keywords