Skip to content

Add Predis support#186

Merged
simPod merged 40 commits intoPromPHP:mainfrom
mtk3d:feature/add-predis-support
Mar 24, 2026
Merged

Add Predis support#186
simPod merged 40 commits intoPromPHP:mainfrom
mtk3d:feature/add-predis-support

Conversation

@mtk3d
Copy link
Contributor

@mtk3d mtk3d commented Apr 30, 2025

Hi
I've introduced changes to support Predis as an alternative Redis connection adapter, while maintaining full backward compatibility and avoiding code duplication.
This was achieved by introducing a minimal RedisClient interface, designed according to the YAGNI principle. It only exposes the necessary methods required by the prometheus adapter.
AbstractRedis.php is basically all redis generic logic moved from Redis.php

I know there already is a PR with predis but it seems abandoned.
I see there is still need to have support for predis, also I need one for my project. So I decided to make this one, and I’m ready to help bring it across the finish line 😄

All tests are passing locally, and the code style checks are green, so I hope there will be no issues in pipeline.

@mtk3d mtk3d changed the title Add predis support for basic redis adapter Add predis support for Redis adapter Apr 30, 2025
@mtk3d mtk3d changed the title Add predis support for Redis adapter Add Predis support for Redis adapter Apr 30, 2025
@mtk3d mtk3d force-pushed the feature/add-predis-support branch 6 times, most recently from bdbd3f9 to a3c7a3e Compare April 30, 2025 22:55
@mtk3d mtk3d changed the title Add Predis support for Redis adapter Add Predis support Apr 30, 2025
@mtk3d
Copy link
Contributor Author

mtk3d commented May 1, 2025

Ok, it's ready now

@HugoHeneaultDblc
Copy link

Any updates about this? Could be really nice :)

@LKaemmerling LKaemmerling self-assigned this Mar 18, 2026
@LKaemmerling
Copy link
Member

This looks really good @mtk3d. I just tested it locally and yes it looks good. It would be good to add predis to the blackbox tests as well (4b72fa6#diff-01564c350b960b1aa754a407d2fd8730ce62c5330010e834739d460e123d87e8R43) and there are a few style checks that fail ATM. Can you please have a look for those? We then can release this quite soon :)

@simPod
Copy link
Contributor

simPod commented Mar 19, 2026

@mtk3d CI on main now passes, you can rebase

@mtk3d mtk3d force-pushed the feature/add-predis-support branch from cc364ef to 1c8994c Compare March 19, 2026 19:39
@mtk3d mtk3d requested a review from simPod March 19, 2026 22:04
@mtk3d
Copy link
Contributor Author

mtk3d commented Mar 19, 2026

Thanks for checking and all suggestions. I've applied them and also rebased main branch

@simPod
Copy link
Contributor

simPod commented Mar 19, 2026

Ill check it tmrw. Make sure CI passes please. You can open secondary PR against your fork to be able to trigger actions yourself if needed.

@mtk3d mtk3d force-pushed the feature/add-predis-support branch from 27ee2d8 to 2566bbc Compare March 19, 2026 22:52
Copy link
Contributor

@simPod simPod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, few more stuff to check

@mtk3d mtk3d force-pushed the feature/add-predis-support branch 2 times, most recently from a2db6d8 to dbb236b Compare March 22, 2026 22:59
@mtk3d mtk3d requested a review from simPod March 22, 2026 23:06
mtk3d added 24 commits March 24, 2026 21:09
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
This code has been mentioned as issue because of recurency call. Afeter
quick analyse, I've realised that this is dead code, and it's not used
anywhere.

Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
This is also required by PHPStan

Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
For some reason PHPStan cannot recognize that this method is returning
mixed, and still trying to use int in this code, so this function would
always fall in to if statement.

Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
…version

Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
That allowed me to simplify this adapter as well as removing some
confusing parts of code, where some settings are required but not used

Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
@mtk3d mtk3d force-pushed the feature/add-predis-support branch from dfae421 to ae19f84 Compare March 24, 2026 20:09
@mtk3d
Copy link
Contributor Author

mtk3d commented Mar 24, 2026

Ok, done. Thank you @simPod for detailed review! I really appreciate your work.
All comments have been addressed (maybe except one I'm not sure about).
I've also signed all commits.

@mtk3d mtk3d requested a review from simPod March 24, 2026 20:13
Copy link
Member

@LKaemmerling LKaemmerling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good, thank you a lot! Great work @mtk3d (and thanks @simPod as well!)

@simPod simPod merged commit da86f15 into PromPHP:main Mar 24, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants