Seastar
High performance C++ framework for concurrent servers
|
Class that creates label instances.
A factory class to create label instance Typically, the same Label name is used in multiple places. label is a label factory, you create it once, and use it to create the label_instance.
In the example we would like to label the smp_queue with with the queue owner
seastar::metrics::label smp_owner("smp_owner");
now, when creating a new smp metric we can add a label to it:
sm::make_queue_length("send_batch_queue_length", _last_snt_batch, {smp_owner(cpuid)})
where cpuid in this case is unsiged.
#include <seastar/core/metrics.hh>
Public Types | |
using | instance = label_instance |
Public Member Functions | |
label (const sstring &key) | |
creating a label key is the label name, it will be the key for all label_instance that will be created from this label. | |
template<typename T > | |
instance | operator() (T value) const |
creating a label instance More... | |
const sstring & | name () const |
returns the label name | |
|
inline |
creating a label instance
Use the function operator to create a new label instance. T - the value type can be any type that can be lexical_cast to string (ie. if it support the redirection operator for stringstream).
All primitive types are supported so if lab is a label, all the following examples are valid: lab(1) lab("my_value") lab(-1)