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 $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;

View File

@ -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