Plugin(cloud::google::gcp::management::stackdriver) - Mode(getmetrics): allow compatibility with DISTRIBUTION type values CTOR-1643 (#5609)

This commit is contained in:
itoussies 2025-06-25 16:34:30 +02:00 committed by GitHub
parent da00258077
commit 4abce275b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -333,9 +333,14 @@ sub gcp_get_metrics {
} }
my $metric_calc = { points => 0 }; my $metric_calc = { points => 0 };
my $value;
foreach my $point (@{$timeserie->{points}}) { foreach my $point (@{$timeserie->{points}}) {
if (defined($point->{value})) { 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})) { if (defined($aggregations{average})) {
$metric_calc->{average} = 0 if (!defined($metric_calc->{average})); $metric_calc->{average} = 0 if (!defined($metric_calc->{average}));
$metric_calc->{average} += $value; $metric_calc->{average} += $value;

View File

@ -97,6 +97,7 @@ Fortinet
FQDN FQDN
FreeBSD FreeBSD
frsevent frsevent
GCP
--get-param --get-param
HAProxy HAProxy
HashiCorp HashiCorp
@ -266,6 +267,7 @@ SRX
SSDCapacity SSDCapacity
SSG SSG
SSH SSH
Stackdriver
standAlone standAlone
statefile statefile
--statefile-concat-cwd --statefile-concat-cwd