14#include <boost/shared_ptr.hpp>
50 return ((std::chrono::duration_cast<std::chrono::seconds>(dur)).count());
66typedef std::pair<double, SampleClock::time_point>
FloatSample;
72typedef std::pair<std::string, SampleClock::time_point>
StringSample;
114 Observation(
const std::string& name,
const int64_t value);
126 Observation(
const std::string& name,
const double value);
138 Observation(
const std::string& name,
const std::string& value);
223 void setValue(
const std::string& value);
253 void addValue(
const std::string& value);
320 std::list<FloatSample>
getFloats()
const;
356 template<
typename StorageType>
357 size_t getSizeInternal(StorageType& storage,
Type exp_type)
const;
371 template<
typename SampleType,
typename StorageType>
372 void setValueInternal(SampleType value, StorageType& storage,
383 template<
typename SampleType,
typename Storage>
384 SampleType getValueInternal(Storage& storage,
Type exp_type)
const;
394 template<
typename SampleType,
typename Storage>
395 std::list<SampleType> getValuesInternal(Storage& storage,
396 Type exp_type)
const;
404 template<
typename StorageType>
405 void setMaxSampleAgeInternal(StorageType& storage,
414 template<
typename StorageType>
415 void setMaxSampleCountInternal(StorageType& storage,
416 uint32_t max_samples,
Type exp_type);
431 std::pair<bool, uint32_t> max_sample_count_;
437 static std::pair<bool, uint32_t> default_max_sample_count_;
446 std::pair<bool, StatsDuration> max_sample_age_;
452 static std::pair<bool, StatsDuration> default_max_sample_age_;
462 std::list<IntegerSample> integer_samples_;
465 std::list<BigIntegerSample> big_integer_samples_;
468 std::list<FloatSample> float_samples_;
471 std::list<DurationSample> duration_samples_;
474 std::list<StringSample> string_samples_;
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown if invalid statistic type is used.
InvalidStatType(const char *file, size_t line, const char *what)
Represents a single observable characteristic (a 'statistic')
static std::string typeToText(Type type)
Converts statistic type to string.
static const StatsDuration & getMaxSampleAgeDefault()
Get default maximum age of samples.
void setValue(const int64_t value)
@
Type getType() const
Returns statistic type.
std::list< FloatSample > getFloats() const
Returns observed float samples.
void reset()
Resets statistic.
std::string getName() const
Returns observation name.
FloatSample getFloat() const
Returns observed float sample.
static uint32_t getMaxSampleCountDefault()
Get default maximum count of samples.
std::pair< bool, StatsDuration > getMaxSampleAge() const
Returns both values of max_sample_age_ of statistic.
void addValue(const int64_t value)
Records incremental integer observation.
StringSample getString() const
Returns observed string sample.
std::list< BigIntegerSample > getBigIntegers() const
Returns observed big-integer samples.
size_t getSize() const
Returns size of observed storage.
Type
Type of available statistics.
@ STAT_BIG_INTEGER
this statistic is signed 128-bit integer value
@ STAT_INTEGER
this statistic is signed 64-bit integer value
@ STAT_STRING
this statistic represents a string
@ STAT_FLOAT
this statistic is a floating point value
@ STAT_DURATION
this statistic represents time duration
isc::data::ConstElementPtr getJSON() const
Returns as a JSON structure.
void setMaxSampleCount(uint32_t max_samples)
Determines how many samples of a given statistic should be kept.
static void setMaxSampleCountDefault(uint32_t max_samples)
Determines default maximum count of samples.
IntegerSample getInteger() const
Returns observed integer sample.
static void setMaxSampleAgeDefault(const StatsDuration &duration)
Determines default maximum age of samples.
void setMaxSampleAge(const StatsDuration &duration)
Determines maximum age of samples.
BigIntegerSample getBigInteger() const
Returns observed integer sample.
std::list< StringSample > getStrings() const
Returns observed string samples.
std::pair< bool, uint32_t > getMaxSampleCount() const
Returns both values of max_sample_count_ of statistic.
std::list< IntegerSample > getIntegers() const
Returns observed integer samples.
std::list< DurationSample > getDurations() const
Returns observed duration samples.
Observation(const std::string &name, const int64_t value)
Constructor for integer observations.
DurationSample getDuration() const
Returns observed duration sample.
std::pair< double, SampleClock::time_point > FloatSample
Float (implemented as double precision)
std::pair< int64_t, SampleClock::time_point > IntegerSample
Integer (implemented as signed 64-bit integer)
std::pair< std::string, SampleClock::time_point > StringSample
String.
std::pair< isc::util::int128_t, SampleClock::time_point > BigIntegerSample
BigInteger (implemented as signed 128-bit integer)
std::pair< StatsDuration, SampleClock::time_point > DurationSample
Time Duration.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
std::chrono::system_clock SampleClock
Define clock type.
long toSeconds(const StatsDuration &dur)
Returns the number of seconds in a duration.
std::chrono::system_clock::duration StatsDuration
Defines duration type.
boost::multiprecision::checked_int128_t int128_t
Defines the logger used by the top-level component of kea-lfc.