Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
Metric whose value is a set of items. More...
#include <collection-metrics.h>
Public Member Functions | |
SetMetric (const std::string &key, const std::set< T > &value, const std::string &description="") | |
void | Add (const T &item) |
Put an item in this set. More... | |
void | Remove (const T &item) |
Remove an item from this set by value. More... | |
void | Reset () |
virtual void | ToJson (rapidjson::Document *document, rapidjson::Value *value) |
name, value, human_readable, description More... | |
virtual void | ToLegacyJson (rapidjson::Document *document) |
This method is kept for backwards-compatibility with CM5.0. More... | |
virtual std::string | ToHumanReadable () |
const std::string & | key () const |
const std::string & | description () const |
Protected Member Functions | |
void | AddStandardFields (rapidjson::Document *document, rapidjson::Value *val) |
Protected Attributes | |
const std::string | key_ |
Unique key identifying this metric. More... | |
const std::string | description_ |
Private Attributes | |
boost::mutex | lock_ |
Lock protecting the set. More... | |
std::set< T > | value_ |
The set of items. More... | |
Metric whose value is a set of items.
Collection metrics are those whose values have more structure than simple scalar types. Therefore they need specialised ToJson() methods, and typically a specialised API for updating the values they contain.
Definition at line 43 of file collection-metrics.h.
|
inline |
Definition at line 45 of file collection-metrics.h.
|
inline |
Put an item in this set.
Definition at line 49 of file collection-metrics.h.
Referenced by impala::Statestore::RegisterSubscriber(), and impala::TEST().
|
protectedinherited |
Convenience method to add standard fields (name, description, human readable string) to 'val'.
Definition at line 46 of file metrics.cc.
References impala::name.
Referenced by impala::SetMetric< std::string >::ToJson(), impala::StatsMetric< double >::ToJson(), and impala::SimpleMetric< T, metric_kind >::ToJson().
|
inlineinherited |
Definition at line 72 of file metrics.h.
References impala::Metric::description_.
|
inlineinherited |
Definition at line 71 of file metrics.h.
References impala::Metric::key_.
Referenced by impala::SimpleMetric< T, metric_kind >::Increment().
|
inline |
Remove an item from this set by value.
Definition at line 55 of file collection-metrics.h.
Referenced by impala::TEST(), and impala::Statestore::UnregisterSubscriber().
|
inline |
Definition at line 60 of file collection-metrics.h.
|
inlinevirtual |
Writes a human-readable representation of this metric to 'out'. This is the representation that is often displayed in webpages etc.
Implements impala::Metric.
Definition at line 85 of file collection-metrics.h.
Referenced by impala::TEST().
|
inlinevirtual |
name, value, human_readable, description
Builds a new Value into 'val', using (if required) the allocator from 'document'. Should set the following fields where appropriate:
Implements impala::Metric.
Definition at line 62 of file collection-metrics.h.
|
inlinevirtual |
This method is kept for backwards-compatibility with CM5.0.
Adds a new json value directly to 'document' of the form: "name" : "human-readable-string"
Implements impala::Metric.
Definition at line 75 of file collection-metrics.h.
|
protectedinherited |
Description of this metric. TODO: share one copy amongst metrics with the same description.
Definition at line 80 of file metrics.h.
Referenced by impala::Metric::description().
|
protectedinherited |
Unique key identifying this metric.
Definition at line 76 of file metrics.h.
Referenced by impala::Metric::key(), impala::SetMetric< std::string >::ToLegacyJson(), impala::StatsMetric< double >::ToLegacyJson(), and impala::SimpleMetric< T, metric_kind >::ToLegacyJson().
|
private |
Lock protecting the set.
Definition at line 94 of file collection-metrics.h.
Referenced by impala::SetMetric< std::string >::Add(), and impala::SetMetric< std::string >::Remove().
|
private |
The set of items.
Definition at line 97 of file collection-metrics.h.
Referenced by impala::SetMetric< std::string >::Add(), impala::SetMetric< std::string >::Remove(), impala::SetMetric< std::string >::Reset(), impala::SetMetric< std::string >::ToHumanReadable(), impala::SetMetric< std::string >::ToJson(), and impala::SetMetric< std::string >::ToLegacyJson().