21 StatContext::get(
const std::string& name)
const {
22 auto obs = stats_.find(name);
23 if (obs != stats_.end()) {
31 auto existing = stats_.find(obs->getName());
32 if (existing == stats_.end()) {
33 stats_.insert(make_pair(obs->getName() ,obs));
36 <<
" already exists.");
41 StatContext::del(
const std::string& name) {
42 auto obs = stats_.find(name);
43 if (obs != stats_.end()) {
52 return (stats_.size());
56 StatContext::clear() {
61 StatContext::resetAll() {
63 for (
auto s : stats_) {
70 StatContext::getAll()
const {
73 for (
auto s : stats_) {
75 map->set(s.first, s.second->getJSON());
81 StatContext::setMaxSampleCountAll(uint32_t max_samples) {
83 for (
auto s : stats_) {
85 s.second->setMaxSampleCount(max_samples);
92 for (
auto s : stats_) {
94 s.second->setMaxSampleAge(duration);
boost::shared_ptr< Element > ElementPtr
Exception indicating that a given statistic is duplicated.
std::chrono::system_clock::duration StatsDuration
Defines duration type.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.