]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
open_telemetry_collector plugin: Unify the setting of `family->type`.
authorFlorian Forster <octo@collectd.org>
Thu, 1 Feb 2024 11:30:42 +0000 (12:30 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 20 Feb 2024 14:28:50 +0000 (15:28 +0100)
src/open_telemetry_collector.cc

index 7b9f7932a4f714a2e6e2087eb5e644aee422e3ed..6aad492a85662d13169a151d8e1a6a6be3242800 100644 (file)
@@ -173,7 +173,6 @@ static grpc::Status unmarshal_data_point(NumberDataPoint dp,
       // (#4266)
       // fam->type = METRIC_TYPE_FPCOUNTER;
       // m.value.fpcounter = dp.as_double();
-      fam->type = METRIC_TYPE_COUNTER;
       m.value.counter = offset.counter + (counter_t)dp.as_double();
       break;
     }
@@ -181,7 +180,6 @@ static grpc::Status unmarshal_data_point(NumberDataPoint dp,
     break;
   case NumberDataPoint::kAsInt:
     if (is_cumulative) {
-      fam->type = METRIC_TYPE_COUNTER;
       m.value.counter = offset.counter + (counter_t)dp.as_int();
       break;
     }
@@ -270,6 +268,7 @@ static grpc::Status dispatch_metric(Metric mpb, label_set_t resource,
     break;
   }
   case Metric::kSum: {
+    fam.type = METRIC_TYPE_COUNTER;
     grpc::Status s = unmarshal_sum_metric(mpb.sum(), &fam);
     if (!s.ok()) {
       metric_family_metric_reset(&fam);