Seastar
High performance C++ framework for concurrent servers
Public Member Functions | List of all members
seastar::metrics::label_instance Class Reference

Detailed Description

Label a metrics.

Label are useful for adding information about a metric that later you would need to aggregate by. For example, if you have multiple queues on a shard. Adding the queue id as a Label will allow you to use the same name of the metrics with multiple id instances.

label_instance holds an instance of label consist of a key and value.

Typically you will not generate a label_instance yourself, but use a label object for that.

See also
label for more information

#include <seastar/core/metrics.hh>

Public Member Functions

template<typename T >
 label_instance (const sstring &key, T v)
 create a label_instance label instance consists of key and value. The key is an sstring. T - the value type can be any type that can be fmt::format'ed to string (ie. if it provides fmt::format<T> specialization). More...
 
const sstring key () const
 returns the label key
 
const sstring value () const
 returns the label value
 
bool operator< (const label_instance &) const
 
bool operator== (const label_instance &) const
 
bool operator!= (const label_instance &) const
 

Constructor & Destructor Documentation

◆ label_instance()

template<typename T >
seastar::metrics::label_instance::label_instance ( const sstring &  key,
v 
)
inline

create a label_instance label instance consists of key and value. The key is an sstring. T - the value type can be any type that can be fmt::format'ed to string (ie. if it provides fmt::format<T> specialization).

All primitive types are supported so all the following examples are valid: label_instance a("smp_queue", 1) label_instance a("my_key", "my_value") label_instance a("internal_id", -1)


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