DEV Community

Rodel Talampas
Rodel Talampas

Posted on

Sending Custom / Error Events to Dynatrace

Alert and Notifications can be sent to Dynatrace for a Single Source of Truth against Errors and Issues encountered within an organization's applications.

More detail can be found at Events API v1 - POST an event and
Events API v2 - POST an event.

Events can be sent to Dynatrace using the Events API. For this tutorial, we will be using Events API v2 as it is very easy to use. The Events API v1 though is more precise based on my opinion. Will look into it more in another documentation post.

Requirements:

  • Dynatrace API Token that can Ingest Events and Write Entities
  • Dynatrace Events API URL
  • Dynatrace Events API Json Body

API Token

API URL

The API URL is https://.live.dynatrace.com/api/v2/events/ingest.

Request Body

Basic Event structure is below.

{
  "eventType": "AVAILABILITY_EVENT",
  "title": "string",
  "startTime": 1,
  "endTime": 1,
  "timeout": 1,
  "entitySelector": "string",
  "properties": {}
}
Enter fullscreen mode Exit fullscreen mode
  • eventType - is the type of event you want to post to Dynatrace
  • title - is the Name of the Problem that will be displayed on the Problems Page
  • startTime - start time of the event in UTC Milliseconds
  • endTime - the end time of the event in UTC Milliseconds
  • timeout - the amount of time, in seconds, the event will be highlighted on the Problems Page
  • entitySelector - set of entities you want the event to be associated with, this is an entity query selector format
  • properties - a map of entity properties

Only eventType and title are required and the rest are optional. If you want to attach the event to specific resources, entitySelector is your friend. If you don’t specify the timeout, 15 minutes is the default.

Sample Request

{
  "eventType": "ERROR_EVENT",
  "title": "Error Test",
  "timeout": 2,
  "entitySelector": "type(service),entityName(\"app-prod - app-lambda-instance\")",
  "properties": {}
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)