Patron service set up is broken
mantzas opened this issue · 0 comments
Is your feature request related to a problem? Please describe
With the removal of the builder pattern, the setup of Patron has become a one-liner with the New()
function.
Previously though, by using the builder, we created a builder first which set up everything and then we created the service and ran it.
The result is that logging and tracing are not set up correctly and the whole main function in the service is using the default logger.
Is this a bug? Please provide steps to reproduce, a failing test etc.
Just by creating a service, the problem is apparent.
Describe the solution
In order to avoid reintroducing the builder pattern again, we could keep the New()
function which sets up a service (logging, tracing etc.) at the beginning of the main and provide the components to run in the Run()
method. This would give us the flexibility of the functional option pattern without the extra builder struct. Another benefit is that we are now decoupling the HTTP component from the service. If the end user would like to set up a worker without an HTTP endpoint this was not possible because Patron by default created an HTTP service. Somebody might want to start without or even instead HTTP start a gRPC one.