diff --git a/composer.json b/composer.json index f2f8b90..f13a353 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "endclothing/prometheus_client_php", + "name": "satariall/prometheus_client_php", "description": "Prometheus instrumentation library for PHP applications.", "type": "library", "license": "Apache-2.0", @@ -13,9 +13,9 @@ "jimdo/prometheus_client_php": "*" }, "require": { - "php": "^7.2", + "php": "^7.2||^8.0", "ext-json": "*", - "guzzlehttp/guzzle": "^6.3", + "guzzlehttp/guzzle": "^7.0.1", "symfony/polyfill-apcu": "^1.6" }, "require-dev": { diff --git a/src/Prometheus/RenderTextFormat.php b/src/Prometheus/RenderTextFormat.php index a5b78dc..ede33ae 100644 --- a/src/Prometheus/RenderTextFormat.php +++ b/src/Prometheus/RenderTextFormat.php @@ -56,6 +56,7 @@ private function renderSample(MetricFamilySamples $metric, Sample $sample): stri */ private function escapeLabelValue($v): string { + $v = is_array($v) ? $v : (string) $v; $v = str_replace("\\", "\\\\", $v); $v = str_replace("\n", "\\n", $v); $v = str_replace("\"", "\\\"", $v); diff --git a/src/Prometheus/Storage/Redis.php b/src/Prometheus/Storage/Redis.php index 5570685..c42e367 100644 --- a/src/Prometheus/Storage/Redis.php +++ b/src/Prometheus/Storage/Redis.php @@ -147,12 +147,12 @@ private function connectToServer(): bool if ($this->options['persistent_connections']) { return $this->redis->pconnect( $this->options['host'], - $this->options['port'], - $this->options['timeout'] + (int)$this->options['port'], + (float)$this->options['timeout'] ); } - return $this->redis->connect($this->options['host'], $this->options['port'], $this->options['timeout']); + return $this->redis->connect($this->options['host'], (int)$this->options['port'], (float)$this->options['timeout']); } catch (\RedisException $e) { return false; }