From 4abce275b9dc169d017f99dc60c1d004bb79a8b0 Mon Sep 17 00:00:00 2001 From: itoussies <65223458+itoussies@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:34:30 +0200 Subject: [PATCH] Plugin(cloud::google::gcp::management::stackdriver) - Mode(getmetrics): allow compatibility with DISTRIBUTION type values CTOR-1643 (#5609) --- src/cloud/google/gcp/custom/api.pm | 7 ++++++- tests/resources/spellcheck/stopwords.txt | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cloud/google/gcp/custom/api.pm b/src/cloud/google/gcp/custom/api.pm index 2884df93a..35e48e53c 100644 --- a/src/cloud/google/gcp/custom/api.pm +++ b/src/cloud/google/gcp/custom/api.pm @@ -333,9 +333,14 @@ sub gcp_get_metrics { } my $metric_calc = { points => 0 }; + my $value; foreach my $point (@{$timeserie->{points}}) { if (defined($point->{value})) { - my $value = $point->{value}->{ lc($timeserie->{valueType}) . 'Value' }; + if (lc($timeserie->{valueType}) eq 'distribution') { + $value = $point->{value}->{ lc($timeserie->{valueType}) . 'Value' }->{count}; + } else { + $value = $point->{value}->{ lc($timeserie->{valueType}) . 'Value' }; + } if (defined($aggregations{average})) { $metric_calc->{average} = 0 if (!defined($metric_calc->{average})); $metric_calc->{average} += $value; diff --git a/tests/resources/spellcheck/stopwords.txt b/tests/resources/spellcheck/stopwords.txt index be46b1b64..1a9ed2e6c 100644 --- a/tests/resources/spellcheck/stopwords.txt +++ b/tests/resources/spellcheck/stopwords.txt @@ -97,6 +97,7 @@ Fortinet FQDN FreeBSD frsevent +GCP --get-param HAProxy HashiCorp @@ -266,6 +267,7 @@ SRX SSDCapacity SSG SSH +Stackdriver standAlone statefile --statefile-concat-cwd