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.
main
v$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 | [] |
url
should be the LIVE Dynatrace domain, eg:https://{your-environment-id}.live.dynatrace.com
Your token
must be Dynatrace APIv2 Token with the following permissions
granted to it:
- Read Metrics
- Read Events
- Ingest Metrics
- Ingest Events
Optionally supplied Metric formats support the following:
gauge
count
Event types must be one of the following:
AVAILABILITY_EVENT
CUSTOM_ALERT
CUSTOM_ANNOTATION
CUSTOM_CONFIGURATION
CUSTOM_DEPLOYMENT
CUSTOM_INFO
ERROR_EVENT
MARKED_FOR_TERMINATION
PERFORMANCE_EVENT
RESOURCE_CONTENTION_EVENT
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 }}"
Install the dependencies
npm install
Lint, test and build the TypeScript and package it for distribution
npm run all
Bug reports and pull requests are welcome on GitHub at https://github.com/dynatrace-oss/dynatrace-github-action.
See LICENSE