Skip to content

Commit 614d772

Browse files
committed
improved README
1 parent 6d31986 commit 614d772

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ For example:
115115
monitoring->send({10, "myMetricInt"});
116116
```
117117
118-
### Custom metric
118+
### Customized metrics
119119
Two additional methods can be chained the to `send(Metric&& metric)` in order to __insert custom tags__ or __set custom timestamp__:
120120
+ `addTags(std::vector<Tag>&& tags)`
121121
+ `setTimestamp(std::chrono::time_point<std::chrono::system_clock>& timestamp)`
@@ -126,15 +126,36 @@ monitoring->send(Metric{10, "myMetric"}.addTags({{"tag1", "value1"}, {"tag2", "v
126126
monitoring->send(Metric{10, "myCrazyMetric"}.setTimestamp(timestamp));
127127
```
128128

129-
### Multiple values
130-
It's also possible to send multiple values in a single metric (only InfluxDB is currently supported, other backends fallback into sending metrics one by one)
129+
### Grouped values
130+
It's also possible to send multiple, grouped values in a single metric (`Flume` and `InfluxDB` backends are supproted, others fallback into sending values in seperate metrics)
131131
```cpp
132-
void send(std::string name, std::vector<Metric>&& metrics)
132+
void sendGroupped(std::string name, std::vector<Metric>&& metrics)
133133
```
134134
135135
For example:
136136
```cpp
137-
monitoring->send("measurementName", {{20, "myMetricIntMultiple"}, {20.30, "myMetricFloatMultple"}});
137+
monitoring->sendGroupped("measurementName", {{20, "myMetricIntMultiple"}, {20.30, "myMetricFloatMultple"}});
138+
```
139+
140+
## Buffering metrics
141+
In order to avoid sending each metric separately, metrics can be temporary stored in the buffer and flushed at the most convenient moment.
142+
This feature can be operated with following two methods:
143+
```cpp
144+
monitoring->enableBuffering(const unsigned int maxSize)
145+
...
146+
monitoring->flushBuffer();
147+
```
148+
149+
`enableBuffering` takes maximum buffer size as its parameter. The buffer gets full all values are flushed automatically.
150+
151+
For example:
152+
```cpp
153+
monitoring->enableBuffering(5);
154+
for (int i = 1; i < 10; i++) {
155+
monitoring->send({10, "myMetricInt"});
156+
}
157+
monitoring->send({20, "myMetricInt2"});
158+
monitoring->flushBuffer();
138159
```
139160

140161
## Features and additional information

0 commit comments

Comments
 (0)