fix(netdata): mode get-chart - wrong values (#3394)

This commit is contained in:
qgarnier 2022-01-11 10:19:11 +01:00 committed by GitHub
parent c754ec8ae3
commit 77e2f794ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,22 +123,23 @@ sub manage_selection {
my $chart_name = $self->{option_results}->{chart_name}; my $chart_name = $self->{option_results}->{chart_name};
my $stat = $self->{option_results}->{chart_statistics}; my $stat = $self->{option_results}->{chart_statistics};
$self->{metrics}->{$chart_name} = {};
# we remove the first time value
shift @{$result->{labels}};
foreach my $chart_value (@{$result->{data}}) { foreach my $chart_value (@{$result->{data}}) {
shift(@$chart_value);
foreach my $chart_label (@{$result->{labels}}) { foreach my $chart_label (@{$result->{labels}}) {
$self->{metrics}->{$chart_name}->{$chart_label} = shift @{$chart_value}; $self->{metrics}->{$chart_name}->{$chart_label} = shift(@$chart_value);
} }
} }
foreach my $metric (keys %{$self->{metrics}->{$chart_name}}) { foreach my $metric (keys %{$self->{metrics}->{$chart_name}}) {
next if ($metric eq 'time'); $self->{metric}->{$metric . '_' . $stat} = {
foreach my $value (values %{$self->{metrics}->{$chart_name}}) { display => $metric . '_' . $stat,
$self->{metric}->{$metric . '_' . $stat} = { value => $self->{metrics}->{$chart_name}->{$metric},
display => $metric . '_' . $stat, unit => $unit,
value => $value, perf_label => $metric . '_' . $stat
unit => $unit, };
perf_label => $metric . '_' . $stat
};
}
} }
}; };