Skip to content

Commit 3de6ed3

Browse files
djklim87djklim87
andauthored
Fix: Metrics rate (#561)
Co-authored-by: djklim87 <[email protected]>
1 parent 5d8c5c8 commit 3de6ed3

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

composer.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Plugin/Metrics/Handler.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ private static function getThreadsMetrics(Client $client): void {
773773
$maxTime = $rowTime;
774774
}
775775

776-
777776
self::addMetric('thread_count', $threadCount);
778777
self::addMetric('slowest_thread', $maxTime);
779778
}
@@ -881,10 +880,10 @@ private static function drawMetrics(): array {
881880
}
882881

883882
/**
884-
* @param string $name
885-
* @param string|float|int $value
886-
* @param array<string, string>|null $label $label
887-
* @return void
883+
* @param string $name
884+
* @param string|float|int $value
885+
* @param array<string, string>|null $label
886+
* @return void
888887
*/
889888
private static function addMetric(string $name, string|float|int $value, ?array $label = null): void {
890889
if (!isset(self::$metricNames[$name]['name'])) {
@@ -895,14 +894,14 @@ private static function addMetric(string $name, string|float|int $value, ?array
895894
$value = 0;
896895
}
897896

898-
if ($name === 'killed_rate' && is_numeric($value)) {
897+
if ($name === 'killed_rate') {
899898
$value = (float)$value;
900899
}
901900

902901
if (is_string($value)
903902
&& (str_contains($name, 'query_time_')
904-
|| str_contains($name, 'found_rows_'))) {
905-
/** @var array<string, string> $row */
903+
|| str_contains($name, 'found_rows_'))) {
904+
/** @var array<string, string> $row */
906905
$row = json_decode($value, true);
907906

908907
foreach ($row as $k => $v) {
@@ -927,8 +926,8 @@ private static function addMetric(string $name, string|float|int $value, ?array
927926
}
928927

929928
/**
930-
* @param array<string, float|int|string>|null $label
931-
* @return string
929+
* @param array<string, float|int|string>|null $label
930+
* @return string
932931
*/
933932
private static function getLabel(?array $label): string {
934933
$result = '';

0 commit comments

Comments
 (0)