Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit c550246

Browse files
authored
Add comments about why opencensus_task is added. (#385)
1 parent cc198ff commit c550246

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

opencensus/exporters/stats/stackdriver/internal/stackdriver_utils.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ void SetMetricDescriptor(
169169
MakeType(metric_name_prefix, view_descriptor.name());
170170
metric_descriptor->set_type(metric_type);
171171
if (IsKnownCustomMetric(metric_type)) {
172+
// Custom metrics use this label so that different processes produce
173+
// different timeseries instead of colliding.
172174
SetOpenCensusTaskLabelDescriptor(metric_descriptor->add_labels());
173175
}
174176
for (const auto& tag_key : view_descriptor.columns()) {
@@ -217,6 +219,8 @@ std::vector<google::monitoring::v3::TimeSeries> MakeTimeSeries(
217219
}
218220
SetTimestamp(data.end_time(), interval->mutable_end_time());
219221
if (IsKnownCustomMetric(metric_type)) {
222+
// Custom metrics use this label so that different processes produce
223+
// different timeseries instead of colliding.
220224
(*base_time_series.mutable_metric()->mutable_labels())[kOpenCensusTaskKey] =
221225
std::string(opencensus_task);
222226
}

0 commit comments

Comments
 (0)