Kea: isc::stats::StatContext Struct Reference

| Kea 3.0.3-git

isc::stats::StatContext Struct Reference

Statistics context. More...

`#include <context.h>`

## Public Member Functions
void | add (const ObservationPtr &obs)
| Adds a new observation.
void | clear ()
| Removes all observations.
bool | del (const std::string &name)
| Attempts to delete an observation.
ObservationPtr | get (const std::string &name) const
| Attempts to get an observation.
isc::data::ConstElementPtr | getAll () const
| Returns a map with all observations.
void | resetAll ()
| Resets all observations.
void | setMaxSampleAgeAll (const StatsDuration &duration)
| Sets duration for all observations.
void | setMaxSampleCountAll (uint32_t max_samples)
| Sets max sample count for all observations.
size_t | size ()
| Returns the number of observations.

## Detailed Description

Statistics context.

Statistics context is essentially a container used to group statistics related to a given context together. Two examples of such contexts are all statistics related to a given subnet or all statistics related to a given network interface.

Definition at line 31 of file context.h.

## Member Function Documentation

## ◆ add()

void isc::stats::StatContext::add | ( | const ObservationPtr & | obs | ) |

Adds a new observation.

Parameters

  obs | observation to be added

Exceptions

  DuplicateStat | if an observation with the same name exists already

Definition at line 30 of file context.cc.

References isc_throw.

## ◆ clear()

void isc::stats::StatContext::clear | ( |  | ) |

Removes all observations.

Definition at line 56 of file context.cc.

## ◆ del()

bool isc::stats::StatContext::del | ( | const std::string & | name | ) |

Attempts to delete an observation.

Parameters

  name | name of the observation to be deleted

Returns
  true if successful, false if no such statistic was found

Definition at line 41 of file context.cc.

## ◆ get()

ObservationPtr isc::stats::StatContext::get | ( | const std::string & | name | ) | const

Attempts to get an observation.

Parameters

  name | name of the statistic

Returns
  appropriate Observation object (or NULL)

Definition at line 21 of file context.cc.

## ◆ getAll()

ConstElementPtr isc::stats::StatContext::getAll | ( |  | ) | const

Returns a map with all observations.

Returns
  map with all observations

Definition at line 70 of file context.cc.

References Element::createMap().

Here is the call graph for this function:

## ◆ resetAll()

void isc::stats::StatContext::resetAll | ( |  | ) |

Resets all observations.

Definition at line 61 of file context.cc.

## ◆ setMaxSampleAgeAll()

void isc::stats::StatContext::setMaxSampleAgeAll | ( | const StatsDuration & | duration | ) |

Sets duration for all observations.

Parameters

  duration | value to be set for all observations

Definition at line 90 of file context.cc.

## ◆ setMaxSampleCountAll()

void isc::stats::StatContext::setMaxSampleCountAll | ( | uint32_t | max_samples | ) |

Sets max sample count for all observations.

Parameters

  max_samples | value to be set for all observations

Definition at line 81 of file context.cc.

## ◆ size()

size_t isc::stats::StatContext::size | ( |  | ) |

Returns the number of observations.

Returns
  the number of observations

Definition at line 51 of file context.cc.

The documentation for this struct was generated from the following files:

- context.h
- context.cc