12 #include <boost/noncopyable.hpp>
13 #include <boost/scoped_ptr.hpp>
80 void setValue(
const std::string& name,
const int64_t value);
87 void setValue(
const std::string& name,
const double value);
101 void setValue(
const std::string& name,
const std::string& value);
108 void addValue(
const std::string& name,
const int64_t value);
115 void addValue(
const std::string& name,
const double value);
129 void addValue(
const std::string& name,
const std::string& value);
210 bool reset(
const std::string& name);
216 bool del(
const std::string& name);
229 size_t getSize(
const std::string& name)
const;
234 size_t count()
const;
281 template<
typename Type>
282 static std::string
generateName(
const std::string& context, Type index,
283 const std::string& stat_name) {
284 std::stringstream name;
285 name << context <<
"[" << index <<
"]." << stat_name;
490 template<
typename DataType>
495 stat->setValue(value);
514 template<
typename DataType>
527 existing->addValue(value);
561 bool deleteObservation(
const std::string& name);
571 bool deleteObservationInternal(
const std::string& name);
582 bool setMaxSampleAgeInternal(
const std::string& name,
const StatsDuration& duration);
593 bool setMaxSampleCountInternal(
const std::string& name, uint32_t max_samples);
602 void setMaxSampleAgeAllInternal(
const StatsDuration& duration);
611 void setMaxSampleCountAllInternal(uint32_t max_samples);
620 void setMaxSampleAgeDefaultInternal(
const StatsDuration& duration);
628 void setMaxSampleCountDefaultInternal(uint32_t max_samples);
645 uint32_t getMaxSampleCountDefaultInternal()
const;
655 bool resetInternal(
const std::string& name);
665 bool delInternal(
const std::string& name);
672 void resetAllInternal();
679 void removeAllInternal();
689 size_t getSizeInternal(
const std::string& name)
const;
698 size_t countInternal()
const;
734 std::string& reason);
756 std::string& reason);
776 uint32_t& max_samples,
777 std::string& reason);
783 const boost::scoped_ptr<std::mutex> mutex_;
boost::shared_ptr< StatContext > StatContextPtr
Pointer to the statistics context.
static isc::data::ConstElementPtr statisticGetHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-get command.
static isc::data::ConstElementPtr statisticSetMaxSampleAgeHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-age-set command.
void addObservation(const ObservationPtr &stat)
Adds a new observation.
isc::data::ConstElementPtr statisticSetMaxSampleCountAllHandler(const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-count-set-all command.
void setMaxSampleCountDefault(uint32_t max_samples)
Set default count limit.
void addObservationInternal(const ObservationPtr &stat)
Adds a new observation in a thread safe context.
void addValueInternal(const std::string &name, DataType value)
Adds specified value to a given statistic (internal version).
void setMaxSampleCountAll(uint32_t max_samples)
Set count limit for all collected statistics.
static isc::data::ConstElementPtr statisticGetAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-get-all command.
bool setMaxSampleAge(const std::string &name, const StatsDuration &duration)
Determines maximum age of samples.
ObservationPtr getObservation(const std::string &name) const
Returns an observation.
static isc::data::ConstElementPtr statisticResetHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-reset command.
size_t count() const
Returns number of available statistics.
static StatsMgr & instance()
Statistics Manager accessor method.
Statistics Manager class.
isc::data::ConstElementPtr getAll() const
Returns all statistics as a JSON structure.
void removeAll()
Removes all collected statistics.
std::chrono::system_clock::duration StatsDuration
Defines duration type.
void setMaxSampleAgeAll(const StatsDuration &duration)
Set duration limit for all collected statistics.
size_t getSize(const std::string &name) const
Returns size of specified statistic.
static isc::data::ConstElementPtr statisticResetAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-reset-all command.
bool del(const std::string &name)
Removes specified statistic.
static isc::data::ConstElementPtr statisticRemoveAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-remove-all command.
static isc::data::ConstElementPtr statisticSetMaxSampleCountHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-count-set command.
boost::shared_ptr< const Element > ConstElementPtr
static std::string generateName(const std::string &context, Type index, const std::string &stat_name)
Generates statistic name in a given context.
static isc::data::ConstElementPtr statisticRemoveHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-remove command.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
void resetAll()
Resets all collected statistics back to zero.
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool setMaxSampleCount(const std::string &name, uint32_t max_samples)
Determines how many samples of a given statistic should be kept.
void setValueInternal(const std::string &name, DataType value)
Sets a given statistic to specified value (internal version).
bool reset(const std::string &name)
Resets specified statistic.
Represents a single observable characteristic (a 'statistic')
isc::data::ConstElementPtr statisticSetMaxSampleAgeAllHandler(const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-age-set-all command.
void setMaxSampleAgeDefault(const StatsDuration &duration)
Set default duration limit.
const StatsDuration & getMaxSampleAgeDefault() const
Get default duration limit.
uint32_t getMaxSampleCountDefault() const
Get default count limit.
ObservationPtr getObservationInternal(const std::string &name) const
Returns an observation in a thread safe context.
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
void setValue(const std::string &name, const int64_t value)
Records absolute integer observation.