Skip to content

Commit 70ad77c

Browse files
committed
Comments
1 parent 8cf6d49 commit 70ad77c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/datadog/metrics.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
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.
4048
class 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.
4859
class GaugeMetric : public Metric {
4960
public:
5061
GaugeMetric(const std::string name, const std::vector<std::string> tags,

0 commit comments

Comments
 (0)