N|Solid
|
Class to retrieve a stream of some thread-specific metrics. More...
#include <nsolid.h>
Public Types | |
enum | Type : uint32_t { Type::kRawDns = 1 << 0, Type::kRawHttpClient = 1 << 1, Type::kRawHttpServer = 1 << 2, Type::kRawGcRegular = 1 << 3, Type::kRawGcForced = 1 << 4, Type::kRawGcFull = 1 << 5, Type::kRawGcMajor = 1 << 6, Type::kRawGc = 120 } |
types of metrics that can be collected using MetricsStream. More... | |
using | metrics_stream_bucket = std::vector< std::tuple< Type, double > > |
using | metrics_stream_proxy_sig = void(*)(MetricsStream *, metrics_stream_bucket, void *) |
Public Member Functions | |
MetricsStream (uint64_t thread_id) | |
Construct a new Metrics Stream object. More... | |
~MetricsStream () | |
Destroy the Metrics Stream object. More... | |
template<typename Cb , typename... Data> | |
int | Start (uint32_t flags, uint64_t timeout, uint32_t max_items, Cb &&cb, Data &&... data) |
start collecting specific metrics. More... | |
int | Stop () |
stop collecting metrics. More... | |
uint64_t | ThreadId () |
returns the thread_id the metrics are being gathered from. More... | |
Class to retrieve a stream of some thread-specific metrics.
For some specific metrics: dns request duration, http client transaction duration, http server transaction duration and garbage collection duration, it's useful to receive all the datapoints collected by the N|Solid runtime instead of (or in addition to) the derived metrics calculated by N|Solid such as: dns_count, dns_median, dns99_ptile, etc. The MetricsStrem provides that specific feature.
|
strong |
types of metrics that can be collected using MetricsStream.
They can be combined in a flags field to specify which metrics are to be collected.
|
explicit |
Construct a new Metrics Stream object.
thread_id | the id of the JS thread the metrics are going to be retrieved from. |
node::nsolid::MetricsStream::~MetricsStream | ( | ) |
Destroy the Metrics Stream object.
int node::nsolid::MetricsStream::Start | ( | uint32_t | flags, |
uint64_t | timeout, | ||
uint32_t | max_items, | ||
Cb && | cb, | ||
Data &&... | data | ||
) |
start collecting specific metrics.
The metrics will be returned in bucket in a callback. This callback will be called periodically either when the bucket reaches the max_items
size or timeout
milliseconds have passed.
flags | allows filtering which specific metrics are going to be retrieved. |
timeout | metrics gathering maximum period. If reached without filling the bucket, the callback is called. |
max_items | metrics bucket maximum capacity. When it's reached the callback is called. |
cb | callback function with the following signature: cb(MetricsStream*, metrics_stream_bucket, ...Data) |
data | variable number of arguments to be propagated to the callback. |
int node::nsolid::MetricsStream::Stop | ( | ) |
stop collecting metrics.
uint64_t node::nsolid::MetricsStream::ThreadId | ( | ) |
returns the thread_id the metrics are being gathered from.