11{
12 if (!reg)
13 {
14 throw std::invalid_argument("Can't init ZeroMQ statistics. Registry is null");
15 }
16
17 const auto name = prependName.empty() ? "zeromq_" : prependName + "_zeromq_";
18
19
21
22
24 &prometheus::BuildInfo().Name(name.substr(0, name.size() - 1)).Help("ZeroMQ server information").Register(*reg);
25
26 _infoFamily->Add({{
"init_time", date::format(
"%FT%TZ", date::floor<std::chrono::nanoseconds>(
27 std::chrono::high_resolution_clock::now()))}});
28 _infoFamily->Add({{
"performance_unit",
"nanoseconds"}});
29
30
32 .Name(name + "succeeded_command_parts")
33 .Help("Number of received succeeded message parts")
34 .Register(*reg)
35 .Add({});
37 .Name(name + "failed_command_parts")
38 .Help("Number of received failed message parts")
39 .Register(*reg)
40 .Add({});
42 .Name(name + "total_command_parts")
43 .Help("Number of received total message parts")
44 .Register(*reg)
45 .Add({});
46
47
49 &prometheus::BuildCounter().Name(name + "uploaded_bytes").Help("Total uploaded bytes").Register(*reg).Add({});
51 .Name(name + "downloaded_bytes")
52 .Help("Total downloaded bytes")
53 .Register(*reg)
54 .Add({});
55}
void initBaseStats(const std::shared_ptr< prometheus::Registry > ®, const std::string &name)
prometheus::Counter * _failedCommandParts
Number of received failed message parts.
prometheus::Counter * _totalDownloadBytes
Total downloaded bytes.
prometheus::Counter * _totalCommandParts
Number of received total message parts.
prometheus::Counter * _succeededCommandParts
Number of received succeeded message parts.
prometheus::Counter * _totalUploadBytes
Total uploaded bytes.
prometheus::Family< prometheus::Info > * _infoFamily
Information metric family.