Parameters for creating events
OptionalaggregationKey?: stringOptional aggregation key to group events together
Array of event requests to send to Datadog
Promise resolving to an array of results, one for each event request
// Create multiple events
const results = await CreateEvent({
requests: [
{
title: "Deployment started",
text: "Starting deployment of service XYZ to production",
tags: ["environment:production", "service:xyz"],
alertType: "info",
priority: "normal"
},
{
title: "High CPU Usage Alert",
text: "CPU usage exceeded 90% for 5 minutes",
tags: ["environment:production", "resource:cpu"],
alertType: "warning",
priority: "normal"
}
],
aggregationKey: "deployment-123"
})
// Access event URLs from the results
results.forEach(result => {
console.log(`Event created: ${result.eventUrl}`)
})
Creates one or more events in Datadog using the Events API.
This function sends the provided event requests to the Datadog API and returns the results. It requires the DATADOG_API_KEY and DATADOG_APP_KEY environment variables to be set.