You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,9 +11,30 @@ A header-only StatsD client implemented in C++.
9
11
The client allows:
10
12
- batching,
11
13
- change of configuration at runtime,
12
-
- user-define frequency rate.
14
+
- user-defined frequency rate.
15
+
16
+
## Install and Test
17
+
18
+
### Makefile
19
+
20
+
In order to install the header files and/or run the tests, simply use the Makefile and execute
21
+
22
+
```
23
+
make install
24
+
```
25
+
26
+
and
27
+
28
+
```
29
+
make test
30
+
```
31
+
32
+
### Conan
33
+
34
+
If you are using [Conan](https://www.conan.io/) to manage your dependencies, merely add statsdclient/x.y.z@vthiery/stable to your conanfile.py's requires, where x.y.z is the release version you want to use. Please file issues here if you experience problems with the packages. You can also directly download the latest version [here](https://bintray.com/vthiery/conan-packages/statsdclient%3Avthiery/_latestVersion).
The configuration of the client must be input when one instantiates it. Nevertheless, the API allows the configuration ot change afterwards. For example, one can do the following:
72
+
73
+
```cpp
74
+
#include"StatsdClient.hpp"
75
+
usingnamespaceStatsd;
76
+
77
+
intmain()
78
+
{
79
+
// Define the client on localhost, with port 8080, using a prefix and a batching size of 20 bytes
The batchsize is the only parameter that cannot be changed for the time being.
92
+
93
+
### Batching
94
+
95
+
The client supports batching of the metrics:
96
+
* the unit of the batching parameter is bytes,
97
+
* it is optional and not setting it will result in an immediate send of any metrics,
98
+
99
+
If set, the UDP sender will spawn a thread sending the metrics to the server every 1 second by aggregates. The aggregation logic is as follows:
100
+
* if the last message has already reached the batching limit, add a new element in a message queue;
101
+
* otherwise, append the message to the last one, separated by a `\n`.
102
+
103
+
### Frequency rate
104
+
105
+
When sending a metric, a frequency rate can be set in order to limit the metrics' sampling. By default, the frequency rate is set to one and won't affect the sampling. If set to a value `epsilon` (0.0001 for the time being) close to one, the sampling is not affected either.
106
+
107
+
If the frequency rate is set and `epsilon` different from one, the sending will be rejected randomly (the higher the frequency rate, the lower the probability of rejection).
0 commit comments