kazan icon indicating copy to clipboard operation
kazan copied to clipboard

Allow replacing of Kazan.Client.Imp via configuration

Open chazsconi opened this issue 4 years ago • 1 comments

As mentioned in https://github.com/obmarg/kazan/pull/72 we have a wrapper around Kazan.run/2 for instrumentation.

It would be useful if the module that Kazan.run/1 and Kazan.run/2 delegates to could be changed by configuration. This way we could easy provide our own implementation which wraps calls to Kazan.Client.Imp.run/2 with instrumentation.

This would also be useful to allow Kazan.Client.Imp to be replaced by a mock module for testing an app that uses Kazan.

To do this I would also suggest moving Kazan.Client.Imp.run!/2 to the Kazan module (as it's just a wrapper around run/2) and leaving run/2 as the only function that is required to be implemented in Kazan.Client.Imp or a mock implementation. A behaviour could also be added.

@obmarg I can provide a PR for this if you agree with the approach.

chazsconi avatar Oct 09 '19 13:10 chazsconi

This is an interesting idea, not one I'd considered. Not sure where I stand: is there a reason to do this in Kazan vs. implementing this in your app?

obmarg avatar Oct 09 '19 13:10 obmarg