Closed vrslev closed 1 week ago
I see that OpentelemetryInstrument
assumes that we are running an HTTP application. Can we make split it into OpentelemetryInstrument
and ApplicationOpentelemetryInstrument
?
In the inner source package we have the enter_bootstrapper_context()
context manager which I introduced while back:
def run_main() -> None:
with enter_bootstrapper_context(
LoggingBootstrapper, OpenTelemetryBootstrapper, SentryBootstrapper, settings=settings
):
uvloop.run(worker_application.run_consumer())
The inner source package has quite different architecture underneath, though. I'm sure we won't be able to do something as simple as that.
Hm, sounds good, but actually, there are no limitations to the bootstrapper, you can bootstrap literally everything you want. What kind of worker are you talking about? Our innersource has it's own mq library, but we are moving towards faststream step by step. Can you provide a worker example, that requires bootstrapping?
Actually, I will be working on moving some services in my team to FastStream. The main issue with FastStream would be that it often enough is ran alongside an HTTP application.
On our “workers”: they’re handwritten (no framework such as FastStream) application, that are executed in separate containers. They process message streams
Hm, sounds good, but actually, there are no limitations to the bootstrapper, you can bootstrap literally everything you want.
You mean that there’s no need to have another bootstrapper? I second that: there’re plenty of “generic” applications, not Litestar/FastAPI, that can benefit from microbootstrap
Currently microbootstrap doesn't handle apps that are not Litestar or FastAPI apps, moreover, do not expose any HTTP API.
An example is a worker: it just does some things without serving an API. This kind of applications still need logging, Sentry and OpenTelemetry.
We can change bootstrapper hierarchy into something like this:
And settings hierarchy as well:
This way we would have a framework-agnostic bootstrapper. Of course, it would have only a subset of what Litestar/FastAPI bootstrappers can do.