-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDogStatsInterface.php
164 lines (148 loc) · 6.52 KB
/
DogStatsInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
declare(strict_types=1);
namespace Okvpn\Bundle\DatadogBundle\Client;
interface DogStatsInterface
{
public const STATUS_OK = 0;
public const STATUS_WARNING = 1;
public const STATUS_CRITICAL = 2;
public const STATUS_UNKNOWN = 3;
public const PRIORITY_LOW = 'low';
public const PRIORITY_NORMAL = 'normal';
public const ALERT_ERROR = 'error';
public const ALERT_WARNING = 'warning';
public const ALERT_INFO = 'info';
public const ALERT_SUCCESS = 'success';
/**
* Counters track how many times something happens per second, such as page views.
* @link https://docs.datadoghq.com/developers/dogstatsd/data_types/#counters
*
* @param string $metrics Metric(s) to increment
* @param int $delta Value to decrement the metric by
* @param float $sampleRate Sample rate of metric
* @param string[] $tags List of tags for this metric
*
* @return DogStatsInterface
*/
public function increment(string $metrics, int $delta = 1, float $sampleRate = 1.0, array $tags = []);
/**
* Counters track how many times something happens per second, such as page views.
* @link https://docs.datadoghq.com/developers/dogstatsd/data_types/#counters
*
* @param string $metric Metric(s) to decrement
* @param int $delta Value to increment the metric by
* @param float $sampleRate Sample rate of metric
* @param string[] $tags List of tags for this metric
*
* @return DogStatsInterface
*/
public function decrement(string $metric, int $delta = 1, float $sampleRate = 1.0, array $tags = []);
/**
* Timers in DogStatsD are an implementation of Histograms (not to be confused with timers in the standard StatsD).
* They measure timing data only, for example, the amount of time a section of code takes to execute,
* or how long it takes to fully render a page.
* @see https://docs.datadoghq.com/developers/dogstatsd/data_types/#timers
*
* @param string $metric Metric to track
* @param float $time Time in milliseconds
* @param string[] $tags List of tags for this metric
*
* @return DogStatsInterface
*/
public function timing(string $metric, float $time, array $tags = []);
/**
* Time a function
* @link https://docs.datadoghq.com/developers/dogstatsd/data_types/#timers
*
* @param string $metric Metric to time
* @param callable $func Function to record
* @param string[] $tags List of tags for this metric
*
* @return DogStatsInterface
*/
public function time(string $metric, callable $func, array $tags = []);
/**
* Gauges measure the value of a particular thing over time.
* For example, in order to track the amount of free memory on a machine,
* periodically sample that value as the metric system.mem.free:
* @see https://docs.datadoghq.com/developers/dogstatsd/data_types/#gauges
*
* @param string $metric Metric to gauge
* @param int $value Set the value of the gauge
* @param string[] $tags List of tags for this metric
*
* @return DogStatsInterface
*/
public function gauge(string $metric, int $value, array $tags = []);
/**
* Histograms are specific to DogStatsD. They calculate the statistical distribution of any kind of value,
* such as the size of files uploaded to your site:
* @link https://docs.datadoghq.com/developers/dogstatsd/data_types/#histograms
*
* @param string $metric Metric to send
* @param float $value Value to send
* @param float $sampleRate Sample rate of metric
* @param string[] $tags List of tags for this metric
*
* @return DogStatsInterface
*/
public function histogram(string $metric, float $value, float $sampleRate = 1.0, array $tags = []);
/**
* Sets are used to count the number of unique elements in a group,
* for example, the number of unique visitors to your site:
* @link https://docs.datadoghq.com/developers/dogstatsd/data_types/#sets
*
* @param string $metric
* @param int $value
* @param string[] $tags List of tags for this metric
*
* @return DogStatsInterface
*/
public function set(string $metric, int $value, array $tags = []);
/**
* Send a event notification
*
* @link http://docs.datadoghq.com/guides/dogstatsd/#events
*
* @param string $title Event Title
* @param string $text Event Text
* @param array $metadata Set of metadata for this event:
* - time - Assign a timestamp to the event.
* - hostname - Assign a hostname to the event
* - key - Assign an aggregation key to th event, to group it with some others
* - priority - Can be 'normal' or 'low'
* - source - Assign a source type to the event
* - alert - Can be 'error', 'warning', 'info' or 'success'
* @param string[] $tags List of tags for this event
* @return DogStatsInterface
*/
public function event(string $title, string $text, array $metadata = [], array $tags = []);
/**
* DogStatsD can send service checks to Datadog.
* Use checks to track the status of services your application depends on:
* @link https://docs.datadoghq.com/developers/dogstatsd/data_types/#service-checks
*
* @param string $name Name of the service
* @param int $status digit corresponding to the status you’re reporting (OK = 0, WARNING = 1, CRITICAL = 2,
* UNKNOWN = 3)
* @param array $metadata - time - Assign a timestamp to the service check
* - hostname - Assign a hostname to the service check
* @param string[] $tags List of tags for this event
* @return DogStatsInterface
*/
public function serviceCheck(string $name, int $status, array $metadata = [], array $tags = []);
/**
* Get Stat agent transport options
*
* @return array
*/
public function getOptions(): array;
/**
* Get Stat agent transport options
*
* @param string $name Option name
* @param mixed $default Default value
* @return mixed
*/
public function getOption(string $name, $default = null);
}