Closed martinssipenko closed 4 years ago
If you are happy with this way of doing it I'll add tests.
If you are happy with this way of doing it I'll add tests.
I personally think this works! I'd suggest in the future you write tests first, allowing you to design your API first.
But looks good, just add tests. Nice addition to the project 👍
@NoelDavies while trying to integrate my forked branch into my project I noticed that when I inject Redis connection with set prefix, metrics stop working. After poking around for a bit I discovered that PhpRedis adds a prefix to KEYS
only, and not ARGS
. As a result, before my changes, if prefix used lead to redis commands being prefixed too, which lead to errors.
I added tests to cover this case and afterwards changed the KEYS
and ARGS
order. Now this works with and without redis prefix, all tests pass.
I also added an extra check in Redis::fromExistingConnection()
method so that if connection is not established exception is thrown.
I hope this can be released soon.
You know, in this implementation you are close only for one of the Redis implementation and it's breaks an inverse of control pattern.
This implementation should be a default Redis implementation, which implement some RedisClientIntreface, that allows easly extend Redis client implementation by the dev which uses diffrent Redis client.
@piotrooo I can't disagree, however this was not the intention of this pull request. Given implementation already is based on PhpRedis \Redis
class this PR only adds ability to inject same implementation from outside. Perhaps this could be discussed and changed in new major version.
@martinssipenko sounds reasonably. Should be discussed and reimplemented - IMHO.
@NoelDavies any updates on this?
@NoelDavies any updates on this?
@NoelDavies I think you were looking at outdated version of code, all feedback that was given has been implemented - https://github.com/endclothing/prometheus_client_php/pull/8/files
Can we rebase from master to get the CI changes ?
Done, this branch is now up to date with upstream master. However, the CI is still failing because of incompatible Guzzle version, that I fixed in #21. If you want I can fix the CI here or in a different branch forked from current master.
I merged #21 now, it should run the CI fine now?
Rebased again, CI should be green now, also other PRs should be rebased and be green before merging (you can require that CI passes before merge is allowed in githubs branch protection settings).
This PR adds ability to create Redis storage class by injecting existing Redis connection.
Clsoes #7