Actions5
- Metric Actions
Overview
This node sends metrics to DataDog using the StatsD protocol. It supports sending different types of metrics, events, and service checks to a configured DataDog agent. The "Gauge" operation under the "Metric" resource sets a gauge metric, which represents a value that can arbitrarily go up and down (e.g., temperature, current memory usage).
Common scenarios for this node include monitoring application performance, tracking custom business metrics, or reporting system health data to DataDog dashboards and alerts.
For example, you could use the Gauge operation to report the current number of active users on your website or the CPU usage percentage of a server.
Properties
| Name | Meaning |
|---|---|
| Metric Name | The name of the metric to send to DataDog. |
| Value | The numeric value to set for the gauge metric. |
| Sample Rate | A decimal between 0 and 1 representing the sample rate to apply when sending the metric. |
| Tags | Comma-separated tags in the format tag1:value1,tag2:value2 to associate with the metric. |
Output
The node outputs an array of items corresponding to each input item processed. Each output item contains the original JSON data plus additional fields indicating the result of the DataDog operation:
dataDogSuccess: Boolean indicating if the metric was sent successfully.dataDogResource: The resource type used ("metric").dataDogTarget: The host and port of the DataDog agent targeted.dataDogTimestamp: ISO timestamp of when the metric was sent.dataDogError: Present only if sending failed, containing the error message.
No binary data is output by this node.
Dependencies
- Requires a DataDog StatsD agent accessible via UDP at a specified host and port.
- Needs an API key credential configured in n8n for authentication and connection details.
- Uses the
hot-shotsnpm package internally to communicate with DataDog over StatsD. - The node expects the DataDog agent to be running and reachable from the n8n environment.
Troubleshooting
- Connection timeouts: If the node cannot connect to the DataDog agent within 5 seconds, it throws a timeout error. Check network connectivity, firewall rules, and that the DataDog agent is running and listening on the correct UDP port.
- Socket errors: Socket-level errors are logged and cause the node to fail. Verify the host and port configuration and ensure no network policies block UDP traffic.
- Operation timeouts: Sending individual metrics times out after 3 seconds. This may indicate network issues or an unresponsive DataDog agent.
- Invalid operations: Using an unsupported metric operation will throw an error. Ensure the operation is one of the supported types (counter, gauge, histogram, set, distribution).
- Tag formatting: Tags must be comma-separated and formatted as
key:value. Incorrect tag formats might cause unexpected behavior or errors.