Actions5
- Metric Actions
Overview
This node sends metrics, events, and service checks to DataDog using the StatsD protocol. Specifically for the Metric resource with the Counter operation, it increments or decrements a counter metric in DataDog. This is useful for tracking counts of occurrences such as number of requests, errors, or any event you want to count over time.
Common scenarios include:
- Counting API calls or user actions.
- Tracking error occurrences.
- Monitoring job completions or failures.
Example: Incrementing a metric named api.requests
by 1 each time an API call happens.
Properties
Name | Meaning |
---|---|
Metric Name | The name of the metric to increment or decrement (e.g., api.requests ). |
Value | The numeric value to increment/decrement the counter by (default is 1). |
Sample Rate | A decimal between 0 and 1 to apply sampling rate (e.g., 0.5 means send half the metrics). |
Tags | Comma-separated tags to apply to the metric in the format tag1:value1,tag2:value2 . |
Output
The node outputs the original input data augmented with additional fields in the json
property:
dataDogSuccess
: Boolean indicating if the metric was sent successfully.dataDogResource
: The resource type used (metric
).dataDogTarget
: The DataDog host and port 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 output is produced.
Dependencies
- Requires an API key credential for authenticating with DataDog's StatsD endpoint.
- Needs network access to the configured DataDog StatsD host and port (usually UDP).
- Uses the
hot-shots
npm package internally to communicate with DataDog via StatsD protocol. - Node configuration requires setting up credentials with host, port, prefix, environment, and global tags.
Troubleshooting
Connection timeout or failure:
If the node cannot connect to DataDog within 5 seconds, it throws a connection timeout error. Check network policies, DNS resolution, VPN connectivity, and ensure the DataDog agent is running and accepting StatsD metrics on the specified host and port.Operation timeout:
Sending a metric times out after 3 seconds. This may indicate network issues or that the DataDog agent is not responding.Invalid operation:
If an unsupported metric operation is selected, the node will throw an error indicating the operation is not supported.Socket errors:
Socket errors during communication are logged and cause the node to fail. Verify the DataDog agent and network setup.Tag formatting:
Tags must be comma-separated and inkey:value
format. Incorrect tag formatting might cause metrics to be rejected or ignored.