Skip to content

Commit 86fd49e

Browse files
itoussiesscresto31
authored andcommitted
Plugin(cloud::google::gcp::management::stackdriver) - Mode(getmetrics): allow compatibility with DISTRIBUTION type values CTOR-1643 (#5609)
1 parent 8380080 commit 86fd49e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/cloud/google/gcp/custom/api.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,14 @@ sub gcp_get_metrics {
333333
}
334334

335335
my $metric_calc = { points => 0 };
336+
my $value;
336337
foreach my $point (@{$timeserie->{points}}) {
337338
if (defined($point->{value})) {
338-
my $value = $point->{value}->{ lc($timeserie->{valueType}) . 'Value' };
339+
if (lc($timeserie->{valueType}) eq 'distribution') {
340+
$value = $point->{value}->{ lc($timeserie->{valueType}) . 'Value' }->{count};
341+
} else {
342+
$value = $point->{value}->{ lc($timeserie->{valueType}) . 'Value' };
343+
}
339344
if (defined($aggregations{average})) {
340345
$metric_calc->{average} = 0 if (!defined($metric_calc->{average}));
341346
$metric_calc->{average} += $value;

tests/resources/spellcheck/stopwords.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Fortinet
9999
FQDN
100100
FreeBSD
101101
frsevent
102+
GCP
102103
--get-param
103104
HAProxy
104105
HashiCorp
@@ -268,6 +269,7 @@ SRX
268269
SSDCapacity
269270
SSG
270271
SSH
272+
Stackdriver
271273
standAlone
272274
statefile
273275
--statefile-concat-cwd

0 commit comments

Comments
 (0)