Open chis0m opened 1 year ago
Same issue here, Is this because I'm using a certain Laravel version or is there another problem?
@chis0m I am already solved this issue by installing PHP Redis extension, you can following this to phpredis installation https://github.com/phpredis/phpredis/blob/develop/INSTALL.md
if you're using this package in laravel. Prefer to reuse the defined connection.
$connection = $this->app->make('redis')->connection(config('prometheus.redis'))->client();
$adapter = Redis::fromExistingConnection($connection);
$registry = new CollectorRegistry($adapter, false);
$renderer = new RenderTextFormat();
$result = $renderer->render($registry->getMetricFamilySamples());
return response()->json(['data' => $result]);
So installed the package in a Laravel 8.x application and I tried testing by running this part of the example
And I am getting the error
Call to undefined method Illuminate\Support\Facades\Redis::connect()
Which occurs in the packagevendor/promphp/prometheus_client_php/src/Prometheus/Storage/Redis.php:225
How do I fix this? Thanks