Skip to content

Commit 94bfc20

Browse files
committed
Adding comments
1 parent 0d4e82f commit 94bfc20

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/datadog/metrics.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ namespace datadog {
88
namespace tracing {
99

1010
class Metric {
11+
// The name of the metric that will be published. A transformation occurs
12+
// based on the name and whether it is "common" or "language-specific" when it
13+
// is recorded.
1114
const std::string name_;
15+
// The type of the metric. This will currently be count or gauge.
1216
const std::string type_;
17+
// Tags associated with this specific instance of the metric.
1318
const std::vector<std::string> tags_;
19+
// This affects the transformation of the metric name, where it can be a
20+
// common telemetry metric, or a language-specific metric that is prefixed
21+
// with the language name.
1422
bool common_;
1523

1624
protected:
@@ -19,6 +27,8 @@ class Metric {
1927
const std::vector<std::string> tags, bool common);
2028

2129
public:
30+
// Accessors for name, type, tags, common and value are used when producing
31+
// the JSON message for reporting metrics.
2232
const std::string name();
2333
const std::string type();
2434
const std::vector<std::string> tags();

src/datadog/tracer_telemetry.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ class TracerTelemetry {
1212
FinalizedTracerConfig config_;
1313
uint64_t seq_id = 0;
1414
using MetricSnapshot = std::vector<std::pair<time_t, uint64_t>>;
15+
// This uses a reference_wrapper so references to internal metric values can
16+
// be captured, and be iterated trivially when the values need to be
17+
// snapshotted and published in telemetry messages.
1518
std::vector<std::pair<std::reference_wrapper<Metric>, MetricSnapshot>>
1619
metrics_snapshots_;
17-
1820
struct {
1921
struct {
2022
CounterMetric spans_created = {

0 commit comments

Comments
 (0)