Open rdohms opened 6 years ago
Thanks for your contribution!
Can you outline your use case? What testing library are you using? Shouldn't the InMemory()
adapter be sufficient? Also the renderer just takes a bunch of metrics and outputs text, I don't see how having an interface for this helps.
@bracki testing just a side effect, the issue here is more about package design and decoupling.
Part of the reason is that we design our code with SOLID in mind and thus we try to keep to the "D" for Dependency Inversion, which essentially means rely on abstractions not concrete implementations. (more here)
Further more Uncle Bob's Package coupling concepts, specifically SDP and SAP talk extensively about package stability via the DIP. You can read more here
I mention testing as this is where we can clearly observe these dependencies. While trying to test the classes that consume this library I need to make a few mocks and since we avoid mocking concrete classes its easy to observe where interfaces would give us the more stable code to work against.
@bracki any news on this?
This project is dead, but I'm maintaining it under my employer - https://github.com/endclothing/prometheus_client_php. Feel free to submit the PR there.
The registry and the rederer are classes that are usually injected by users into their own code, having interfaces for them allow users to mock based on the API and not on the concret implementation which avoids a common code smell. This also allows better custom implementations if users so desire.