PromPHP / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
415 stars 91 forks source link

RedisCluster support #153

Open mvhirsch opened 4 months ago

mvhirsch commented 4 months ago

I'm currently working on RedisCluster support but do lack knowledge about keyspace and slots. Looks like there was once an approach (see #112), but at the time of writing there is no update.

I managed to connect my RedisCluster, but run into errors like this:

Warning: RedisCluster::eval(): All keys do not map to the same slot 

I read Redis Clustering best practices with keys but to be honest I'm clueless (or keyless? :joy: ). Any help is appreciated. I'd like to get this running soon, as one of my projects needs it.

mvhirsch commented 4 months ago

I see there is also an open request for Redis Sentinel #95 and a pending PR for Predis #127.

I'd like to introduce a RedisAdapter that's capable to work with all of them, by abstracting and hiding away the special use-cases (like in RedisCluster or Predis). Using a method like the one symfony/cache uses, it would be easy to connect to any redis instance supported by them using a simple DSN.

https://github.com/symfony/symfony/blob/02c1e3c5c31dfc7f7f2b13515b060639cfac838a/src/Symfony/Component/Cache/Traits/RedisTrait.php#L87

Of course, that requires a bigger rewrite of the current Redis and I'm still not sure what role RedisNg is (see #152).

WDYT?

LKaemmerling commented 4 months ago

Sounds great!