Closed tforesti closed 1 year ago
Hey,
I think there is an issue, if you try this :
$registry = new \Prometheus\CollectorRegistry(new Prometheus\Storage\Redis()); $histogram = $registry->getOrRegisterHistogram('test', 'some_histogram', 'it observes', [], [0, 1, 2, 3, 4, 5]); $histogram->observe(5); $renderer = new \Prometheus\RenderTextFormat(); $result = $renderer->render($registry->getMetricFamilySamples()); echo $result;
You get PHP Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given Here src/Prometheus/RenderTextFormat.php(59) Because bucket values are "labelized" and labels values are "sanitized".
PHP Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given
src/Prometheus/RenderTextFormat.php(59)
I found a workaround :
$histogram = $registry->getOrRegisterHistogram('test', 'some_histogram', 'it observes', [], ['0', '1', '2', '3', '4', '5']);
But I think it is not the way it should work, am I right ?
Hi @tforesti I think this was fixed in https://github.com/PromPHP/prometheus_client_php/pull/17 .
Hi, yes it actually seems to be OK, I probably made a mistake with versions, sorry!
Hey,
I think there is an issue, if you try this :
You get
PHP Fatal error: Uncaught TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given
Heresrc/Prometheus/RenderTextFormat.php(59)
Because bucket values are "labelized" and labels values are "sanitized".I found a workaround :
But I think it is not the way it should work, am I right ?