This GitHub Action enables CI/CD workflows to report Events and Metrics to a Dynatrace monitoring environment using the REST API. For additional context and details please refer to the Dynatrace API.
This repository was bootstrapped using the typescript-action template.
The following tags are available for the dynatrace-oss/dynatrace-github-action
action.
mainv$MAJOR(eg:v2)v$MAJOR.$MINOR(eg:v2.1)v$MAJOR.$MINOR.$PATCH(eg:v2.1.6)
Note
See to the Releases page for all available versions.
| Name | Type | Description | Default |
|---|---|---|---|
url |
String | Dynatrace URL [1] | required |
token |
String | Dynatrace API-Token | required |
metrics |
YAML | Inline YAML list of Metrics to send | [] |
events |
YAML | Inline YAML list of Events to send | [] |
sdlc-events |
YAML | Inline YAML list of SDLC Events to send via OpenPipeline | [] |
urlshould be the LIVE Dynatrace domain, eg:https://{your-environment-id}.live.dynatrace.com
Your token must be a Dynatrace API token with the following permissions
granted to it:
- Read Metrics (
metrics.read) - Read Events (
events.read) - Ingest Metrics (
metrics.ingest) - Ingest Events (
events.ingest) - Ingest SDLC Events (
openpipeline.events_sdlc) — required only when usingsdlc-events
Optionally supplied Metric formats support the following:
gaugecount
Event types must be one of the following:
AVAILABILITY_EVENTCUSTOM_ALERTCUSTOM_ANNOTATIONCUSTOM_CONFIGURATIONCUSTOM_DEPLOYMENTCUSTOM_INFOERROR_EVENTMARKED_FOR_TERMINATIONPERFORMANCE_EVENTRESOURCE_CONTENTION_EVENT
SDLC (Software Development Lifecycle) events are ingested via the Dynatrace
OpenPipeline Ingest API
at the /platform/ingest/v1/events.sdlc endpoint.
Each SDLC event must include the event.id field. Any additional properties are
forwarded as-is to the OpenPipeline.
The token must have the openpipeline.events_sdlc scope.
Important
Make sure to use the latest version from the Releases tab!
The following will send a generic untyped metric named github.my.custom.metric
to Dynatrace with a value of 1.0 and several dimensions to filter against. In
this example you could get all metrics for single repository using the
github.repository dimension.
- name: Send metrics to Dynatrace
uses: dynatrace-oss/dynatrace-github-action@v9
with:
url: ${{ secrets.DT_URL }}
token: ${{ secrets.DT_TOKEN }}
metrics: |
- metric: "github.my.custom.metric"
value: "1.0"
dimensions:
github.repository: "${{ github.repository }}"
github.ref: "${{ github.ref }}"
github.event_name: "${{ github.event_name }}"
github.actor: "${{ github.actor }}"The following will send a INFO event named GitHub Event, targeting the
entity type(host),entityName(myHost), with a several properties on the event.
In this example you could get all events for single repository using the
github.repository property.
See the Entity Selector API for help creating selectors. Below are a few examples:
type(host),tag(prod)- Selects all Hosts with a Tagprod.type(service),entityName(login)- Selects all Services with the namelogin
- name: Send events to Dynatrace
uses: dynatrace-oss/dynatrace-github-action@v9
with:
url: ${{ secrets.DT_URL }}
token: ${{ secrets.DT_TOKEN }}
events: |
- title: GitHub Event
type: CUSTOM_INFO
entitySelector: type(host),entityName(myHost)
properties:
source: GitHub
description: This is an example
github.repository: "${{ github.repository }}"
github.ref: "${{ github.ref }}"
github.event_name: "${{ github.event_name }}"
github.actor: "${{ github.actor }}"The following sends a deployment SDLC event to the Dynatrace OpenPipeline. Any
additional properties beyond event.id are forwarded to the pipeline as-is.
- name: Send SDLC event to Dynatrace
uses: dynatrace-oss/dynatrace-github-action@v9
with:
url: ${{ secrets.DT_URL }}
token: ${{ secrets.DT_TOKEN }}
sdlc-events: |
- event.id: "${{ github.run_id }}"
event.type: deployment
event.category: DEPLOY
git.repository: "${{ github.repository }}"
git.commit: "${{ github.sha }}"
git.ref: "${{ github.ref }}"
actor: "${{ github.actor }}"Install the dependencies
npm installLint, test and build the TypeScript and package it for distribution
npm run allBug reports and pull requests are welcome on GitHub at https://github.com/dynatrace-oss/dynatrace-github-action.
See LICENSE