From a4dc3db6b3d1bd3eebf1594b537d8f3527a47df0 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Sun, 5 Apr 2020 13:22:19 +0200 Subject: [PATCH] [#1005] Checkpoint: updated stats lib --- doc/examples/kea4/all-keys.json | 8 ++ doc/examples/kea6/all-keys.json | 8 ++ src/bin/dhcp4/json_config_parser.cc | 4 +- src/bin/dhcp6/json_config_parser.cc | 4 +- src/lib/dhcpsrv/parsers/simple_parser4.cc | 102 ++++++++++---------- src/lib/dhcpsrv/parsers/simple_parser6.cc | 111 +++++++++++----------- src/lib/stats/observation.cc | 61 ++++++++++-- src/lib/stats/observation.h | 41 +++++++- src/lib/stats/stats_mgr.cc | 60 ++++++++++++ src/lib/stats/stats_mgr.h | 56 +++++++++++ 10 files changed, 338 insertions(+), 117 deletions(-) diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json index bb4e43d7b7..cc780a0068 100644 --- a/doc/examples/kea4/all-keys.json +++ b/doc/examples/kea4/all-keys.json @@ -515,6 +515,14 @@ // information) with each lease. "store-extended-info": true, + // Statistics keep some samples per observation point. + // There are two default values: maximum count and maximum age. + // Set the maximum count to zero disables it. + "statistic-default-sample-count": 0, + + // When the maximum count the maximum age (in seconds) applies. + "statistic-default-sample-age": 60, + // Governs how the Kea DHCPv4 server should deal with the invalid // data received from the client. "sanity-checks": { diff --git a/doc/examples/kea6/all-keys.json b/doc/examples/kea6/all-keys.json index 8d57b112d9..36254f026b 100644 --- a/doc/examples/kea6/all-keys.json +++ b/doc/examples/kea6/all-keys.json @@ -456,6 +456,14 @@ // information) with each lease. "store-extended-info": true, + // Statistics keep some samples per observation point. + // There are two default values: maximum count and maximum age. + // Set the maximum count to zero disables it. + "statistic-default-sample-count": 0, + + // When the maximum count the maximum age (in seconds) applies. + "statistic-default-sample-age": 60, + // Governs how the Kea DHCPv6 server should deal with the invalid // data received from the client. "sanity-checks": { diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index df96fcfc65..0cec538b4f 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -576,7 +576,9 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set, (config_pair.first == "ddns-replace-client-name") || (config_pair.first == "ddns-generated-prefix") || (config_pair.first == "ddns-qualifying-suffix") || - (config_pair.first == "store-extended-info")) { + (config_pair.first == "store-extended-info") || + (config_pair.first == "statistic-default-sample-count") || + (config_pair.first == "statistic-default-sample-age")) { CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first, config_pair.second); continue; diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 5bc7244d70..7ee22b648a 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -695,7 +695,9 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set, (config_pair.first == "ddns-replace-client-name") || (config_pair.first == "ddns-generated-prefix") || (config_pair.first == "ddns-qualifying-suffix") || - (config_pair.first == "store-extended-info")) { + (config_pair.first == "store-extended-info") || + (config_pair.first == "statistic-default-sample-count") || + (config_pair.first == "statistic-default-sample-age")) { CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first, config_pair.second); continue; diff --git a/src/lib/dhcpsrv/parsers/simple_parser4.cc b/src/lib/dhcpsrv/parsers/simple_parser4.cc index 5e7e4189df..0b38c7c0fb 100644 --- a/src/lib/dhcpsrv/parsers/simple_parser4.cc +++ b/src/lib/dhcpsrv/parsers/simple_parser4.cc @@ -36,54 +36,56 @@ namespace dhcp { /// list and map types for entries. /// Order follows global_param rule in bison grammar. const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = { - { "valid-lifetime", Element::integer }, - { "min-valid-lifetime", Element::integer }, - { "max-valid-lifetime", Element::integer }, - { "renew-timer", Element::integer }, - { "rebind-timer", Element::integer }, - { "decline-probation-period", Element::integer }, - { "subnet4", Element::list }, - { "shared-networks", Element::list }, - { "interfaces-config", Element::map }, - { "lease-database", Element::map }, - { "hosts-database", Element::map }, - { "hosts-databases", Element::list }, - { "host-reservation-identifiers", Element::list }, - { "client-classes", Element::list }, - { "option-def", Element::list }, - { "option-data", Element::list }, - { "hooks-libraries", Element::list }, - { "expired-leases-processing", Element::map }, - { "dhcp4o6-port", Element::integer }, - { "control-socket", Element::map }, - { "dhcp-queue-control", Element::map }, - { "dhcp-ddns", Element::map }, - { "echo-client-id", Element::boolean }, - { "match-client-id", Element::boolean }, - { "authoritative", Element::boolean }, - { "next-server", Element::string }, - { "server-hostname", Element::string }, - { "boot-file-name", Element::string }, - { "user-context", Element::map }, - { "comment", Element::string }, - { "sanity-checks", Element::map }, - { "reservations", Element::list }, - { "config-control", Element::map }, - { "server-tag", Element::string }, - { "reservation-mode", Element::string }, - { "calculate-tee-times", Element::boolean }, - { "t1-percent", Element::real }, - { "t2-percent", Element::real }, - { "loggers", Element::list }, - { "hostname-char-set", Element::string }, - { "hostname-char-replacement", Element::string }, - { "ddns-send-updates", Element::boolean }, - { "ddns-override-no-update", Element::boolean }, - { "ddns-override-client-update", Element::boolean }, - { "ddns-replace-client-name", Element::string }, - { "ddns-generated-prefix", Element::string }, - { "ddns-qualifying-suffix", Element::string }, - { "store-extended-info", Element::boolean } + { "valid-lifetime", Element::integer }, + { "min-valid-lifetime", Element::integer }, + { "max-valid-lifetime", Element::integer }, + { "renew-timer", Element::integer }, + { "rebind-timer", Element::integer }, + { "decline-probation-period", Element::integer }, + { "subnet4", Element::list }, + { "shared-networks", Element::list }, + { "interfaces-config", Element::map }, + { "lease-database", Element::map }, + { "hosts-database", Element::map }, + { "hosts-databases", Element::list }, + { "host-reservation-identifiers", Element::list }, + { "client-classes", Element::list }, + { "option-def", Element::list }, + { "option-data", Element::list }, + { "hooks-libraries", Element::list }, + { "expired-leases-processing", Element::map }, + { "dhcp4o6-port", Element::integer }, + { "control-socket", Element::map }, + { "dhcp-queue-control", Element::map }, + { "dhcp-ddns", Element::map }, + { "echo-client-id", Element::boolean }, + { "match-client-id", Element::boolean }, + { "authoritative", Element::boolean }, + { "next-server", Element::string }, + { "server-hostname", Element::string }, + { "boot-file-name", Element::string }, + { "user-context", Element::map }, + { "comment", Element::string }, + { "sanity-checks", Element::map }, + { "reservations", Element::list }, + { "config-control", Element::map }, + { "server-tag", Element::string }, + { "reservation-mode", Element::string }, + { "calculate-tee-times", Element::boolean }, + { "t1-percent", Element::real }, + { "t2-percent", Element::real }, + { "loggers", Element::list }, + { "hostname-char-set", Element::string }, + { "hostname-char-replacement", Element::string }, + { "ddns-send-updates", Element::boolean }, + { "ddns-override-no-update", Element::boolean }, + { "ddns-override-client-update", Element::boolean }, + { "ddns-replace-client-name", Element::string }, + { "ddns-generated-prefix", Element::string }, + { "ddns-qualifying-suffix", Element::string }, + { "store-extended-info", Element::boolean }, + { "statistic-default-sample-count", Element::integer }, + { "statistic-default-sample-age", Element::integer } }; /// @brief This table defines default global values for DHCPv4 @@ -114,7 +116,9 @@ const SimpleDefaults SimpleParser4::GLOBAL4_DEFAULTS = { { "ddns-qualifying-suffix", Element::string, "" }, { "hostname-char-set", Element::string, "[^A-Za-z0-9.-]" }, { "hostname-char-replacement", Element::string, "" }, - { "store-extended-info", Element::boolean, "false" } + { "store-extended-info", Element::boolean, "false" }, + { "statistic-default-sample-count", Element::integer, "20" }, + { "statistic-default-sample-age", Element::integer, "0" } }; /// @brief This table defines all option definition parameters. diff --git a/src/lib/dhcpsrv/parsers/simple_parser6.cc b/src/lib/dhcpsrv/parsers/simple_parser6.cc index c2a66735dc..78f19ab940 100644 --- a/src/lib/dhcpsrv/parsers/simple_parser6.cc +++ b/src/lib/dhcpsrv/parsers/simple_parser6.cc @@ -35,55 +35,57 @@ namespace dhcp { /// list and map types for entries. /// Order follows global_param rule in bison grammar. const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = { - { "data-directory", Element::string }, - { "preferred-lifetime", Element::integer }, - { "min-preferred-lifetime", Element::integer }, - { "max-preferred-lifetime", Element::integer }, - { "valid-lifetime", Element::integer }, - { "min-valid-lifetime", Element::integer }, - { "max-valid-lifetime", Element::integer }, - { "renew-timer", Element::integer }, - { "rebind-timer", Element::integer }, - { "decline-probation-period", Element::integer }, - { "subnet6", Element::list }, - { "shared-networks", Element::list }, - { "interfaces-config", Element::map }, - { "lease-database", Element::map }, - { "hosts-database", Element::map }, - { "hosts-databases", Element::list }, - { "mac-sources", Element::list }, - { "relay-supplied-options", Element::list }, - { "host-reservation-identifiers", Element::list }, - { "client-classes", Element::list }, - { "option-def", Element::list }, - { "option-data", Element::list }, - { "hooks-libraries", Element::list }, - { "expired-leases-processing", Element::map }, - { "server-id", Element::map }, - { "dhcp4o6-port", Element::integer }, - { "control-socket", Element::map }, - { "dhcp-queue-control", Element::map }, - { "dhcp-ddns", Element::map }, - { "user-context", Element::map }, - { "comment", Element::string }, - { "sanity-checks", Element::map }, - { "reservations", Element::list }, - { "config-control", Element::map }, - { "server-tag", Element::string }, - { "reservation-mode", Element::string }, - { "calculate-tee-times", Element::boolean }, - { "t1-percent", Element::real }, - { "t2-percent", Element::real }, - { "loggers", Element::list }, - { "hostname-char-set", Element::string }, - { "hostname-char-replacement", Element::string }, - { "ddns-send-updates", Element::boolean }, - { "ddns-override-no-update", Element::boolean }, - { "ddns-override-client-update", Element::boolean }, - { "ddns-replace-client-name", Element::string }, - { "ddns-generated-prefix", Element::string }, - { "ddns-qualifying-suffix", Element::string }, - { "store-extended-info", Element::boolean } + { "data-directory", Element::string }, + { "preferred-lifetime", Element::integer }, + { "min-preferred-lifetime", Element::integer }, + { "max-preferred-lifetime", Element::integer }, + { "valid-lifetime", Element::integer }, + { "min-valid-lifetime", Element::integer }, + { "max-valid-lifetime", Element::integer }, + { "renew-timer", Element::integer }, + { "rebind-timer", Element::integer }, + { "decline-probation-period", Element::integer }, + { "subnet6", Element::list }, + { "shared-networks", Element::list }, + { "interfaces-config", Element::map }, + { "lease-database", Element::map }, + { "hosts-database", Element::map }, + { "hosts-databases", Element::list }, + { "mac-sources", Element::list }, + { "relay-supplied-options", Element::list }, + { "host-reservation-identifiers", Element::list }, + { "client-classes", Element::list }, + { "option-def", Element::list }, + { "option-data", Element::list }, + { "hooks-libraries", Element::list }, + { "expired-leases-processing", Element::map }, + { "server-id", Element::map }, + { "dhcp4o6-port", Element::integer }, + { "control-socket", Element::map }, + { "dhcp-queue-control", Element::map }, + { "dhcp-ddns", Element::map }, + { "user-context", Element::map }, + { "comment", Element::string }, + { "sanity-checks", Element::map }, + { "reservations", Element::list }, + { "config-control", Element::map }, + { "server-tag", Element::string }, + { "reservation-mode", Element::string }, + { "calculate-tee-times", Element::boolean }, + { "t1-percent", Element::real }, + { "t2-percent", Element::real }, + { "loggers", Element::list }, + { "hostname-char-set", Element::string }, + { "hostname-char-replacement", Element::string }, + { "ddns-send-updates", Element::boolean }, + { "ddns-override-no-update", Element::boolean }, + { "ddns-override-client-update", Element::boolean }, + { "ddns-replace-client-name", Element::string }, + { "ddns-generated-prefix", Element::string }, + { "ddns-qualifying-suffix", Element::string }, + { "store-extended-info", Element::boolean }, + { "statistic-default-sample-count", Element::integer }, + { "statistic-default-sample-age", Element::integer } }; /// @brief This table defines default global values for DHCPv6 @@ -106,11 +108,12 @@ const SimpleDefaults SimpleParser6::GLOBAL6_DEFAULTS = { { "ddns-override-client-update", Element::boolean, "false" }, { "ddns-replace-client-name", Element::string, "never" }, { "ddns-generated-prefix", Element::string, "myhost" }, - { "ddns-qualifying-suffix", Element::string, "" }, - { "hostname-char-set", Element::string, "[^A-Za-z0-9.-]" }, - { "hostname-char-replacement", Element::string, "" }, - { "store-extended-info", Element::boolean, "false" } - + { "ddns-qualifying-suffix", Element::string, "" }, + { "hostname-char-set", Element::string, "[^A-Za-z0-9.-]" }, + { "hostname-char-replacement", Element::string, "" }, + { "store-extended-info", Element::boolean, "false" }, + { "statistic-default-sample-count", Element::integer, "20" }, + { "statistic-default-sample-age", Element::integer, "0" } }; /// @brief This table defines all option definition parameters. diff --git a/src/lib/stats/observation.cc b/src/lib/stats/observation.cc index 3253196aaf..926feff85f 100644 --- a/src/lib/stats/observation.cc +++ b/src/lib/stats/observation.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -20,23 +20,38 @@ using namespace boost::posix_time; namespace isc { namespace stats { +std::pair +Observation::default_max_sample_count_ = std::make_pair(true, 20); + +std::pair +Observation::default_max_sample_age_ = + std::make_pair(false, time_duration(0, 0, 0, 0)); + Observation::Observation(const std::string& name, const int64_t value) : - name_(name), type_(STAT_INTEGER) { + name_(name), type_(STAT_INTEGER), + max_sample_count_(default_max_sample_count_), + max_sample_age_(default_max_sample_age_) { setValue(value); } Observation::Observation(const std::string& name, const double value) : - name_(name), type_(STAT_FLOAT) { + name_(name), type_(STAT_FLOAT), + max_sample_count_(default_max_sample_count_), + max_sample_age_(default_max_sample_age_) { setValue(value); } Observation::Observation(const std::string& name, const StatsDuration& value) : - name_(name), type_(STAT_DURATION) { + name_(name), type_(STAT_DURATION), + max_sample_count_(default_max_sample_count_), + max_sample_age_(default_max_sample_age_) { setValue(value); } Observation::Observation(const std::string& name, const std::string& value) : - name_(name), type_(STAT_STRING) { + name_(name), type_(STAT_STRING), + max_sample_count_(default_max_sample_count_), + max_sample_age_(default_max_sample_age_) { setValue(value); } @@ -306,6 +321,7 @@ void Observation::setMaxSampleCountInternal(StorageType& storage, << typeToText(exp_type) << ", but the actual type is " << typeToText(type_)); } + // Should we refuse the max_samples = 0 value here? // setting new value of max_sample_count_ max_sample_count_.first = true; max_sample_count_.second = max_samples; @@ -318,6 +334,37 @@ void Observation::setMaxSampleCountInternal(StorageType& storage, } } +void Observation::setMaxSampleAgeDefault(const StatsDuration& duration) { + // setting new value of default_max_sample_age_ + default_max_sample_age_.second = duration; +} + +void Observation::setMaxSampleCountDefault(uint32_t max_samples) { + if (max_samples == 0) { + // deactivating the default_max_sample_count_ limit + default_max_sample_count_.first = false; + default_max_sample_age_.first = true; + } else { + // setting new value of default_max_sample_count_ + default_max_sample_count_.second = max_samples; + // deactivating the default_max_sample_age_ limit + default_max_sample_age_.first = false; + default_max_sample_count_.first = true; + } +} + +const StatsDuration& Observation::getMaxSampleAgeDefault() { + return (default_max_sample_age_.second); +} + +uint32_t Observation::getMaxSampleCountDefault() { + if (default_max_sample_count_.first) { + return (default_max_sample_count_.second); + } else { + return (0); + } +} + std::string Observation::typeToText(Type type) { std::stringstream tmp; switch (type) { @@ -456,5 +503,5 @@ void Observation::reset() { }; } -}; -}; +} // end of namespace stats +} // end of namespace isc diff --git a/src/lib/stats/observation.h b/src/lib/stats/observation.h index d979500554..bfecbeb57a 100644 --- a/src/lib/stats/observation.h +++ b/src/lib/stats/observation.h @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -68,7 +68,7 @@ typedef std::pair StringSample; /// /// Since Kea 1.6 multiple samples are stored for the same observation. class Observation { - public: +public: /// @brief Type of available statistics /// @@ -140,6 +140,30 @@ class Observation { /// setMaxSampleCount(100); void setMaxSampleCount(uint32_t max_samples); + /// @brief Determines default maximum age of samples. + /// + /// @param duration determines default maximum age of samples. + static void setMaxSampleAgeDefault(const StatsDuration& duration); + + /// @brief Determines default maximum count of samples. + /// + /// @param max_samples default maximum count of samples to keep. + /// (0 means to disable count limit and enable age limit) + static void setMaxSampleCountDefault(uint32_t max_samples); + + /// @brief Get default maximum age of samples. + /// + /// @return default maximum age of samples. + static const StatsDuration& getMaxSampleAgeDefault(); + + /// @brief Get default maximum count of samples. + /// + /// @return max_samples default maximum count of samples to keep. + /// (0 means that count limit was disabled) + static uint32_t getMaxSampleCountDefault(); + + /// @ + /// @brief Records absolute integer observation /// /// @param value integer value observed @@ -354,9 +378,13 @@ private: /// The bool value informs which limit /// is available /// True means active limit, false means inactive limit + std::pair max_sample_count_; + + /// @brief Default maximum number of samples + /// /// By default the MaxSampleCount is set to 20 /// and MaxSampleAge is disabled - std::pair max_sample_count_ = std::make_pair(true, 20); + static std::pair default_max_sample_count_; /// @brief Maximum timespan of samples /// The limit is represented as a pair @@ -365,10 +393,13 @@ private: /// The bool value informs which limit /// is available /// True means active limit, false means inactive limit + std::pair max_sample_age_; + + /// @brief Default maximum timespan of samples + /// /// By default the MaxSampleCount is set to 20 /// and MaxSampleAge is disabled - std::pair max_sample_age_ = std::make_pair(false, - boost::posix_time::time_duration(0, 0, 0, 0)); + static std::pair default_max_sample_age_; /// @defgroup samples_storage Storage for supported observations /// diff --git a/src/lib/stats/stats_mgr.cc b/src/lib/stats/stats_mgr.cc index 1133afd64c..f4ce0e0edc 100644 --- a/src/lib/stats/stats_mgr.cc +++ b/src/lib/stats/stats_mgr.cc @@ -236,6 +236,66 @@ StatsMgr::setMaxSampleCountAllInternal(uint32_t max_samples) { global_->setMaxSampleCountAll(max_samples); } +void +StatsMgr::setMaxSampleAgeDefault(const StatsDuration& duration) { + if (MultiThreadingMgr::instance().getMode()) { + lock_guard lock(*mutex_); + setMaxSampleAgeDefaultInternal(duration); + } else { + setMaxSampleAgeDefaultInternal(duration); + } +} + +void +StatsMgr::setMaxSampleAgeDefaultInternal(const StatsDuration& duration) { + Observation::setMaxSampleAgeDefault(duration); +} + +void +StatsMgr::setMaxSampleCountDefault(uint32_t max_samples) { + if (MultiThreadingMgr::instance().getMode()) { + lock_guard lock(*mutex_); + setMaxSampleCountDefaultInternal(max_samples); + } else { + setMaxSampleCountDefaultInternal(max_samples); + } +} + +void +StatsMgr::setMaxSampleCountDefaultInternal(uint32_t max_samples) { + Observation::setMaxSampleCountDefault(max_samples); +} + +const StatsDuration& +StatsMgr::getMaxSampleAgeDefault() const { + if (MultiThreadingMgr::instance().getMode()) { + lock_guard lock(*mutex_); + return (getMaxSampleAgeDefaultInternal()); + } else { + return (getMaxSampleAgeDefaultInternal()); + } +} + +const StatsDuration& +StatsMgr::getMaxSampleAgeDefaultInternal() const { + return (Observation::getMaxSampleAgeDefault()); +} + +uint32_t +StatsMgr::getMaxSampleCountDefault() const { + if (MultiThreadingMgr::instance().getMode()) { + lock_guard lock(*mutex_); + return (getMaxSampleCountDefaultInternal()); + } else { + return (getMaxSampleCountDefaultInternal()); + } +} + +uint32_t +StatsMgr::getMaxSampleCountDefaultInternal() const { + return (Observation::getMaxSampleCountDefault()); +} + bool StatsMgr::reset(const string& name) { if (MultiThreadingMgr::instance().getMode()) { diff --git a/src/lib/stats/stats_mgr.h b/src/lib/stats/stats_mgr.h index 6ee12ae806..e55ad18e4f 100644 --- a/src/lib/stats/stats_mgr.h +++ b/src/lib/stats/stats_mgr.h @@ -170,6 +170,28 @@ public: /// @param max_samples how many samples of a given statistic should be kept void setMaxSampleCountAll(uint32_t max_samples); + /// @brief Set default duration limit. + /// + /// @param duration determines default maximum age of samples + void setMaxSampleAgeDefault(const StatsDuration& duration); + + /// @brief Set default count limit. + /// + /// @param max_samples default maximum number of samples to keep + /// (0 means to disable count limit and enable age limit) + void setMaxSampleCountDefault(uint32_t max_samples); + + /// @brief Get default duration limit. + /// + /// @return default maximum age of samples. + const StatsDuration& getMaxSampleAgeDefault() const; + + /// @brief Get default count limit. + /// + /// @return default maximum number of samples to keep. + /// (0 means that count limit was disabled) + uint32_t getMaxSampleCountDefault() const; + /// @} /// @defgroup consumer_methods Methods are used by data consumers. @@ -589,6 +611,40 @@ private: /// @private + /// @brief Set default duration limit. + /// + /// Should be called in a thread safe context. + /// + /// @param duration determines default maximum age of samples + void setMaxSampleAgeDefaultInternal(const StatsDuration& duration); + + /// @brief Set default count limit. + /// + /// Should be called in a thread safe context. + /// + /// @param max_samples default maximum number of samples to keep + /// (0 means to disable count limit and enable age limit) + void setMaxSampleCountDefaultInternal(uint32_t max_samples); + + /// @private + + /// @brief Get default duration limit. + /// + /// Should be called in a thread safe context. + /// + /// @return default maximum age of samples. + const StatsDuration& getMaxSampleAgeDefaultInternal() const; + + /// @brief Get default count limit. + /// + /// Should be called in a thread safe context. + /// + /// @return default maximum number of samples to keep. + /// (0 means that count limit was disabled) + uint32_t getMaxSampleCountDefaultInternal() const; + + /// @private + /// @brief Resets specified statistic. /// /// Should be called in a thread safe context.