OpenTelemetry SDK resource detector for GitHub
npm install @opentelemetry/resource-detector-github[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]
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+.
``bash`
npm install --save @opentelemetry/resource-detector-github
`js
const { gitHubDetector } = require('@opentelemetry/resource-detector-github')
async function run() {
// Initialize GitHub Resource Detector
const resource = await gitHubDetector.detect();
};
run()
`
| Resource Attribute | Description |
| ------------------ | --------------------------------------------------------- |
| github.actor | Value of Process Environment Variable GITHUB_ACTOR |GITHUB_BASE_REF
| github.base_ref | Value of Process Environment Variable |GITHUB_HEAD_REF
| github.head_ref | Value of Process Environment Variable |GITHUB_REF
| github.ref | Value of Process Environment Variable |GITHUB_RUN_ID
| github.run_id | Value of Process Environment Variable |GITHUB_RUN_NUMBER
| github.run_number | Value of Process Environment Variable |GITHUB_SHA
| github.sha | Value of Process Environment Variable |GITHUB_WORKFLOW` |
| github.workflow | Value of Process Environment Variable
- GitHub Action Environment Variables
- For more information on OpenTelemetry, visit:
- For more about OpenTelemetry JavaScript:
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
Apache 2.0 - See [LICENSE][license-url] for more information.
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/resource-detector-github
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fresource-detector-github.svg