NAME

WebService::DataDog::Metric - Interface to Metric functions in DataDog's API.

VERSION

Version 1.0.3

METHODS

post_metric()

Deprecated. Please use emit() instead.

emit()

Post single/multiple time-series metrics. NOTE: only metrics of type 'gauge' and type 'counter' are supported. You must use a dogstatsd client such as Net::Dogstatsd to post metrics of other types (ex: 'timer', 'histogram', 'sets' or use increment() or decrement() on a counter). The primary advantage of the API vs dogstatsd for posting metrics: API allows posting metrics from the past.

Per DataDog: "The metrics end-point allows you to post metrics data so it can be graphed on Datadog's dashboards."

my $metric = $datadog->build('Metric');
$metric->emit(
	name        => $metric_name,
	type        => $metric_type,  # Optional - gauge|counter. Default=gauge.
	value       => $metric_value, # For posting a single data point, time 'now'
	data_points => $data_points,  # 1+ data points, with timestamps
	host        => $hostname,     # Optional - host that produced the metric
	tags        => $tag_list,     # Optional - tags associated with the metric
);

Examples:
+ Submit a single point with a timestamp of `now`.
$metric->emit(
	name  => 'page_views',
	value => 1000,
);

+ Submit a point with a timestamp.
$metric->emit(
	name        => 'my.pair',
	data_points => [ [ 1317652676, 15 ] ],
);
	
+ Submit multiple points.
$metric->emit(
	name        => 'my.series',
	data_points => 
	[
		[ 1317652676, 15 ],
		[ 1317652800, 16 ],
	]
);

+ Submit a point with a host and tags.
$metric->emit(
	name  => 'my.series',
	value => 100,
	host  => "myhost.example.com",
	tags  => [ "version:1" ],
);

Parameters:

  • name

    The metric name.

  • type

    Optional. Metric type. Allowed values: gauge, counter. Default = gauge.

  • value

    Metric value. Used when you only need to post a single data point, with timestamp 'now'. Use 'data_points' to post a single metric with a timestamp.

  • data_points

    Array of arrays of timestamp and metric value.

  • host

    Optional. Host that generated the metric.

  • tags

    Optional. List of tags associated with the metric.

INTERNAL FUNCTIONS

_error_checks()

$self->_error_checks( %args );

Common error checking for all metric types.