DatadogMetrics class

A manager for reporting measurable statistics to Datadog.

While this library doesn't implement statsd, it aspires to be a similar API.

To batch outbound requests, startQueue may be invoked, sending metrics every x interval.

Constructors

DatadogMetrics(String apiKey, {required String host, List<String> defaultTags = const <String>[], String? prefix})

Properties

currentTime int
Datadog expects the time to be in seconds.
no setter
defaultTags List<String>
Tags that should be submitted with every metric
final
hashCode int
The hash code for this object.
no setterinherited
host String
The host name reported to Datadog
final
prefix String?
A prefix for every metric. Does not end in .
final
queue List<Metric>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

count(String name, int value, {int interval = 1, List<String> tags = const <String>[]}) Metric
????
gauge(String name, int value, {List<String> tags = const <String>[]}) Metric
????
increment(String name, {int? interval, List<String> tags = const <String>[]}) Metric
Increase metric counter by one
mergeTags([List<String> tags = const <String>[]]) Set<String>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rate(String name, int value, {int interval = 1, List<String> tags = const <String>[]}) Metric
????
send(Metric metric) Future<void>
Report the metric to Datadog or add to the queue if it's running
startQueue([Duration? interval]) → void
By starting the queue, all metrics are batched and sent every x interval. This would reduce the number of outbound requests. interval defaults to 10 seconds
stopQueue() → void
Attempts to send queue and invalidates timer
time(String name, Stopwatch stopwatch, {int? interval, List<String> tags = const <String>[]}) Metric
Log the time delta for a metric
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited