diff --git a/.github/workflows/blackbox.yml b/.github/workflows/blackbox.yml index 2944b233..024edd07 100644 --- a/.github/workflows/blackbox.yml +++ b/.github/workflows/blackbox.yml @@ -22,7 +22,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 coverage: none - name: Install dependencies diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4bd07bf4..a9564c3d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -20,7 +20,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 coverage: none - name: Install dependencies @@ -34,10 +34,10 @@ jobs: fail-fast: false matrix: php: - - "7.4" - "8.0" - "8.1" - "8.2" + - "8.3" name: PHPStan on PHP ${{ matrix.php }} steps: - name: Checkout code diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index baafb6ad..8e33fae5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: fail-fast: true matrix: os: [ ubuntu-latest ] - php: [ 7.4, 8.0, 8.1, 8.2 ] + php: [ 8.0, 8.1, 8.2, 8.3 ] dependency-version: [ prefer-lowest, prefer-stable ] redis-version: [ 5, 6, 7 ] diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index f0d50190..5cc69b6a 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-fpm +FROM php:8.2-fpm RUN pecl install redis && docker-php-ext-enable redis RUN pecl install apcu && docker-php-ext-enable apcu diff --git a/src/Prometheus/RenderTextFormat.php b/src/Prometheus/RenderTextFormat.php index 98ee73ea..b160865c 100644 --- a/src/Prometheus/RenderTextFormat.php +++ b/src/Prometheus/RenderTextFormat.php @@ -40,7 +40,7 @@ private function renderSample(MetricFamilySamples $metric, Sample $sample): stri { $labelNames = $metric->getLabelNames(); if ($metric->hasLabelNames() || $sample->hasLabelNames()) { - $escapedLabels = $this->escapeAllLabels($labelNames, $sample); + $escapedLabels = $this->escapeAllLabels($metric, $labelNames, $sample); return $sample->getName() . '{' . implode(',', $escapedLabels) . '} ' . $sample->getValue(); } return $sample->getName() . ' ' . $sample->getValue(); @@ -56,19 +56,20 @@ private function escapeLabelValue(string $v): string } /** + * @param MetricFamilySamples $metric * @param string[] $labelNames * @param Sample $sample * * @return string[] */ - private function escapeAllLabels(array $labelNames, Sample $sample): array + private function escapeAllLabels(MetricFamilySamples $metric, array $labelNames, Sample $sample): array { $escapedLabels = []; $labels = array_combine(array_merge($labelNames, $sample->getLabelNames()), $sample->getLabelValues()); if ($labels === false) { - throw new RuntimeException('Unable to combine labels.'); + throw new RuntimeException('Unable to combine labels for metric named ' . $metric->getName()); } foreach ($labels as $labelName => $labelValue) {