DataDog StatsD icon

DataDog StatsD

Send metrics, logs and events to DataDog using StatsD protocol

Overview

This node sends metrics to DataDog using the StatsD protocol. Specifically, for the "Metric" resource and "Distribution" operation, it tracks the global statistical distribution of a set of values. This is useful for aggregating and analyzing numeric data points over time, such as response times, payload sizes, or any other measurable quantity where you want to understand the distribution rather than just totals or averages.

Common scenarios include monitoring application performance metrics, tracking latency distributions, or collecting custom business metrics that benefit from statistical analysis.

Example: You might send a distribution metric named api.response_time with values representing the response times of your API calls, allowing DataDog to compute percentiles and other statistics.

Properties

Name Meaning
Metric Name The name of the metric to send (e.g., api.response_time).
Value The numeric value of the metric to record (e.g., 250).
Sample Rate A number between 0 and 1 indicating the fraction of events to sample (e.g., 0.5 means 50%).
Tags Comma-separated tags in the format tag1:value1,tag2:value2 to add metadata to the metric.

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:

  • dataDogSuccess: Boolean indicating if the metric was sent successfully.
  • dataDogResource: The resource type used ("metric").
  • dataDogTarget: The target DataDog host and port.
  • 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 configured connection to a DataDog StatsD server, including host, port, and optional prefix and environment tags.
  • Needs an API key credential for authentication (configured in n8n credentials).
  • Uses the hot-shots npm package internally to communicate via UDP with the DataDog agent.
  • The DataDog agent must be running and accessible on the specified host and port.

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 host and port settings and ensure no network policies block UDP traffic.
  • Operation Timeout: Sending individual metrics has a 3-second timeout. If exceeded, the node reports a timeout error for that metric.
  • Invalid Operation: If an unsupported operation is selected, the node throws an error indicating the operation is not supported.
  • Tag Formatting: Tags must be comma-separated pairs in the format key:value. Incorrect formatting may cause unexpected behavior or errors.

Links and References

Discussion