11#pragma once
22
3+ // This component provides an interface, `Metric`, and specific classes for
4+ // Counter and Gauge metrics. A metric has a name, type, and set of key:value
5+ // tags associated with it. Metrics can be general to APM or language-specific.
6+ // General metrics have `common` set to `true`, and language-specific metrics
7+ // have `common` set to `false`.
8+
39#include < atomic>
410#include < string>
511#include < vector>
@@ -27,8 +33,8 @@ class Metric {
2733 const std::vector<std::string> tags, bool common);
2834
2935 public:
30- // Accessors for name, type, tags, common and value are used when producing
31- // the JSON message for reporting metrics.
36+ // Accessors for name, type, tags, common and capture_and_reset_value are used
37+ // when producing the JSON message for reporting metrics.
3238 const std::string name ();
3339 const std::string type ();
3440 const std::vector<std::string> tags ();
@@ -37,6 +43,8 @@ class Metric {
3743 uint64_t capture_and_reset_value ();
3844};
3945
46+ // A count metric is used for measuring activity, and has methods for adding a
47+ // number of actions, or incrementing the current number of actions by 1.
4048class CounterMetric : public Metric {
4149 public:
4250 CounterMetric (const std::string name, const std::vector<std::string> tags,
@@ -45,6 +53,9 @@ class CounterMetric : public Metric {
4553 void add (uint64_t amount);
4654};
4755
56+ // A gauge metric is used for measuring state, and mas methods to set the
57+ // current state, add or subtract from it, or increment/decrement the current
58+ // state by 1.
4859class GaugeMetric : public Metric {
4960 public:
5061 GaugeMetric (const std::string name, const std::vector<std::string> tags,
0 commit comments