Seastar
High performance C++ framework for concurrent servers
Classes | Typedefs | Functions | Variables
seastar::metrics Namespace Reference

Detailed Description

metrics creation and registration

the metrics namespace holds the relevant method and classes to generate metrics.

The metrics layer support registering metrics, that later will be exported via different API protocols.

To be able to support multiple protocols the following simplifications where made:

  1. The id of the metrics is based on the collectd id
  2. A metric could be a single value either a reference or a function

To add metrics definition to class A do the following:

In A header file

class A {
metric_groups _metrics
void setup_metrics();
};

In A source file:

include "core/metrics.hh"
void A::setup_metrics() {
namespace sm = seastar::metrics;
_metrics = sm::create_metric_group();
_metrics->add_group("cache", {sm::make_gauge("bytes", "used", [this] { return _region.occupancy().used_space(); })});
}

Classes

class  description
 Human-readable description of a metric/group. More...
 
class  double_registration
 
struct  histogram
 Histogram data type. More...
 
struct  histogram_bucket
 Histogram bucket type. More...
 
class  label
 Class that creates label instances. More...
 
class  label_instance
 Label a metrics. More...
 
class  metric_definition
 
class  metric_group
 hold a single metric group Initialization is done in the constructor or with a call to add_group More...
 
class  metric_group_definition
 
class  metric_groups
 holds the metric definition. More...
 

Typedefs

using metric_type_def = sstring
 
using metric_name_type = sstring
 
using instance_id_type = sstring
 
using group_name_type = sstring
 

Functions

template<typename T >
impl::metric_definition_impl make_gauge (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={})
 Gauge are a general purpose metric. More...
 
template<typename T >
impl::metric_definition_impl make_gauge (metric_name_type name, description d, T &&val)
 Gauge are a general purpose metric. More...
 
template<typename T >
impl::metric_definition_impl make_gauge (metric_name_type name, description d, std::vector< label_instance > labels, T &&val)
 Gauge are a general purpose metric. More...
 
template<typename T >
impl::metric_definition_impl make_derive (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={})
 Derive are used when a rate is more interesting than the value. More...
 
template<typename T >
impl::metric_definition_impl make_derive (metric_name_type name, description d, T &&val)
 Derive are used when a rate is more interesting than the value. More...
 
template<typename T >
impl::metric_definition_impl make_derive (metric_name_type name, description d, std::vector< label_instance > labels, T &&val)
 Derive are used when a rate is more interesting than the value. More...
 
template<typename T >
impl::metric_definition_impl make_counter (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={})
 create a counter metric More...
 
template<typename T >
impl::metric_definition_impl make_absolute (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={})
 create an absolute metric. More...
 
template<typename T >
impl::metric_definition_impl make_histogram (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={})
 create a histogram metric. More...
 
template<typename T >
impl::metric_definition_impl make_histogram (metric_name_type name, description d, std::vector< label_instance > labels, T &&val)
 create a histogram metric. More...
 
template<typename T >
impl::metric_definition_impl make_histogram (metric_name_type name, description d, T &&val)
 create a histogram metric. More...
 
template<typename T >
impl::metric_definition_impl make_total_bytes (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={}, instance_id_type instance=impl::shard())
 create a total_bytes metric. More...
 
template<typename T >
impl::metric_definition_impl make_current_bytes (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={}, instance_id_type instance=impl::shard())
 create a current_bytes metric. More...
 
template<typename T >
impl::metric_definition_impl make_queue_length (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={}, instance_id_type instance=impl::shard())
 create a queue_length metric. More...
 
template<typename T >
impl::metric_definition_impl make_total_operations (metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={}, instance_id_type instance=impl::shard())
 create a total operation metric. More...
 
future configure (const boost::program_options::variables_map &opts)
 set the metrics configuration
 
boost::program_options::options_description get_options_description ()
 get the metrics configuration desciprtion
 

Variables

const bool metric_disabled
 
label shard_label
 

Class Documentation

◆ seastar::metrics::histogram_bucket

struct seastar::metrics::histogram_bucket
Class Members
uint64_t count
double upper_bound

Typedef Documentation

◆ group_name_type

using seastar::metrics::group_name_type = typedef sstring

A group of logically related metrics

seastar::metrics
metrics creation and registration
seastar::metrics::make_gauge
impl::metric_definition_impl make_gauge(metric_name_type name, T &&val, description d=description(), std::vector< label_instance > labels={})
Gauge are a general purpose metric.
Definition: metrics.hh:393
metrics_registration.hh
holds the metric_groups definition needed by class that reports metrics