Skip to content

OTLP GitHubAction Exporter

Actions
Exports Workflow Run Telemetry as traces with logs in context over OTLP
v3.2.3
Latest
Star (0)

Tags

 (1)

OTLP GitHubAction Exporter

OpenTelemetry Logo

A GitHub Action to export Workflow runs as OTel Traces, Metric and Logs via OTLP

Monitoring Github Actions with OTLP

This action will allow you to monitor your Github Actions with OpenTelemetry. This Action works as an exporter, that will create OpenTelemetry Traces and Spans for the steps within your GitHub Workflows.

These details and metrics can then be used to analyse the performance of your CI/CD workflows.

How to guides

Configuring the OTel GitHubAction Exporter for Dynatrace.

Before setting up the integration, you will need a Dynatrace API Token. This will require the following permissions:

  • openTelemetryTrace.ingest
  • logs.ingest
  • metrics.ingest

Also, refer to the Dynatrace Open Telemetry information page: Using OpenTelemetry with Dynatrace

  1. Configure your Dynatrace API Token as a secret in your repository, and call it DYNATRACE_OTEL_API_TOKEN
  2. Configure your Dynatrace OTLP Endpoint as the OTEL_EXPORTER_OTLP_ENDPOINT - eg. "https://abc12345.live.dynatrace.com/api/v2/otlp/"
  3. Configure your Dynatrace OTLP_PROTOCOL as "HTTP" (Optional as HTTP is the default value)
  4. Configure your OTEL_EXPORTER_OTLP_HEADERS as Authorization=Api-Token ${{ secrets.DYNATRACE_OTEL_API_TOKEN }} to allow it to use the secret from step 1
  5. The exporter uses automatic token authentication by default, for this you need to ensure that GITHUB_TOKEN has at least read access to the action scope (see example Here).

Configuring the OTel GitHubAction Exporter for New Relic.

Before setting up the integration, you will need a New Relic license/ingest API key.

  1. Configure your NewRelic API Key as a secret in your repository, and call it NEWRELIC_OTEL_API_KEY
  2. Configure your NewRelic OTLP Endpoint as the OTEL_EXPORTER_OTLP_ENDPOINT - eg. "https://otlp.nr-data.net:4318/" or "https://otlp.eu01.nr-data.net:4318/"
  3. Configure your Dynatrace OTLP_PROTOCOL as "GRPC"
  4. Configure your OTEL_EXPORTER_OTLP_HEADERS as api-key=${{ secrets.NEWRELIC_OTEL_API_KEY }} to allow it to use the secret from step 1
  5. The exporter uses automatic token authentication by default, for this you need to ensure that GITHUB_TOKEN has at least read access to the action scope (see example Here).

General Tips

Create your workflow yaml, under .github/workflows, this can be named anything you like. Refer to the Dynatrace Example Workflow YML or NewRelic Example Workflow YML.

By having the trigger as:

on:
  workflow_run:
    workflows: ['*']
    types: [completed]

This means it will run whenever any of your other workflows complete - which means you don't need to edit any existing workflows, just put the new yaml file alongside the others in your repository.

If you want to export to 2 locations, I'd recommend a single yaml file with separate jobs for each exporter - otherwise they will pick each others workflow up as a trigger.

Required Configuration Options

ACTION_TOKEN - Typically ${{ secrets.GITHUB_TOKEN }} - however a PAT can be used if it has appropriate permissions

OTEL_EXPORTER_OTLP_ENDPOINT - This is the base endpoint URL for the OTLP Exporters. See OpenTelemetry Docs

WORKFLOW_RUN_ID - This contains the Workflow Run ID for the workflow that triggered this Workflow (ensure it is using the github.event context)

WORKFLOW_RUN_NAME - This contains the Workflow Run Name for the workflow that triggered this Workflow (ensure it is using the github.event context)

Optional Configuration

OTLP_PROTOCOL - This determines the protocol to use for the Exporters (HTTP or GRPC) - Defaults to HTTP

OTEL_EXPORTER_OTLP_HEADERS - Technically optional, however a lot of receivers will need this for the Authorization. This can be used to set the Headers for the OTLP Exporter (Authorization: Api-Token dtc.01......). Enter these in a commas separated, key=value format. See OpenTelemetry Docs

GITHUB_DEBUG - see Troubleshooting

Examples

Traces are viewable in the Distributed Tracing app within Dynatrace. The service name will be your repository name: DsitrubutedTraces

Each trace can be opened to show the steps in context: SingleTrace

Logs will be available through the Traces view, or the Logs application: Logs

Troubleshooting

  • Configure GITHUB_DEBUG as true in your workflow file

Contributing

Please create an issue/PR as needed OTEL GitHubAction Exporter. Example configs and screenshots for other systems would be more than welcome!

License

Dynatrace GitHubAction Exporter is based on gha-new-relic-exporter and has been modified to use Protobuf over HTTP rather than GRPC, and to use the required Authorization header for Dynatrace. This wouldn't be possible (from me at least) without their hard work!

Dynatrace GitHubAction Exporter is licensed under the Apache 2.0 License.

Dynatrace GitHubAction Exporter also use source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.

OTLP GitHubAction Exporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Exports Workflow Run Telemetry as traces with logs in context over OTLP
v3.2.3
Latest

Tags

 (1)

OTLP GitHubAction Exporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.