Thanks to visit codestin.com
Credit goes to github.com

Skip to content

APCng crashing when rendering with integer labels  #154

Closed
@seifane-wise

Description

@seifane-wise

It seems that APCng is not handling integers labels very well.

It registers them correctly when incrementing a counter for example :

$counter = $registry->getOrRegisterCounter(..., ["path", "response_code"]);
$counter->incBy(1, ["a/path/", 200]);

This code was working fine under Redis.

However under APCng when rendering the metrics it seems that it is unable to fetch back the label values if they were all integers and this leads to a crash.

ErrorException: Undefined array key 1 in file /code/vendor/promphp/prometheus_client_php/src/Prometheus/Storage/APCng.php on line 443

#0 /code/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Undefined array...', '/code/vendor/pr...', 443)
#1 /code/vendor/promphp/prometheus_client_php/src/Prometheus/Storage/APCng.php(443): Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}(2, 'Undefined array...', '/code/vendor/pr...', 443)
#2 /code/vendor/promphp/prometheus_client_php/src/Prometheus/Storage/APCng.php(563): Prometheus\Storage\APCng->buildPermutationTree(Array, Array)
#3 /code/vendor/promphp/prometheus_client_php/src/Prometheus/Storage/APCng.php(477): Prometheus\Storage\APCng->getValues('counter', Array)
#4 /code/vendor/promphp/prometheus_client_php/src/Prometheus/Storage/APCng.php(80): Prometheus\Storage\APCng->collectCounters(true)
#5 /code/vendor/promphp/prometheus_client_php/src/Prometheus/CollectorRegistry.php(86): Prometheus\Storage\APCng->collect(true)

Happy to give more details to help resolve this if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions