Seastar
High performance C++ framework for concurrent servers
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Types | Public Member Functions | List of all members
seastar::metrics::label Class Reference

Detailed Description

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
 

Member Function Documentation

◆ operator()()

template<typename T >
instance seastar::metrics::label::operator() ( value) const
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)


The documentation for this class was generated from the following file: