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 "Histogram" operation under the "Metric" resource tracks the statistical distribution of a set of values, which is useful for aggregating data like request durations or payload sizes over time.
Common scenarios include monitoring application performance, tracking usage statistics, or collecting custom telemetry data. For example, you might use the Histogram operation to record response times of API calls, enabling you to analyze latency distributions in DataDog dashboards.
Properties
| Name | Meaning |
|---|---|
| Metric Name | The name of the metric to send. |
| Value | The numeric value of the metric (e.g., duration, count). |
| Sample Rate | A number between 0 and 1 representing the fraction of events to sample (e.g., 0.5 = 50%). |
| Tags | Comma-separated tags to apply to the metric, formatted as tag1:value1,tag2:value2. |
Output
The node outputs an array of items corresponding to each input item processed. Each output item contains the original input data plus additional fields in its json property:
dataDogSuccess: Boolean indicating if the metric was sent successfully.dataDogResource: The resource type used ("metric").dataDogTarget: The host and port of the DataDog agent the metric was sent to.dataDogTimestamp: ISO timestamp when the metric was sent.dataDogError: Present only if sending failed; contains the error message.
No binary data is output by this node.
Dependencies
- Requires a running DataDog agent accessible via UDP at the specified host and port.
- Needs an API key credential configured in n8n for authentication with DataDog.
- Uses the
hot-shotsnpm package internally to communicate with DataDog via StatsD protocol.
Troubleshooting
- Connection Timeout: 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 errors during communication are logged and cause the node to fail. Verify the agent's availability and network policies.
- Operation Timeout: Sending a metric can time out after 3 seconds. This may indicate network issues or agent overload.
- Invalid Operation: If an unsupported operation is selected, the node will throw an error.
- Tag Formatting: Tags must be comma-separated and formatted as
key:value. Incorrect formatting may cause unexpected behavior. - Kubernetes Users: Ensure network policies allow UDP traffic to the DataDog agent port, DNS resolves the agent hostname correctly, and VPNs do not block traffic.