Hi,
I have a couple of custom modules for observability, and they need to bootstrap the same components internally. For example, I want them to share a single OTEL MeterProvider, which I want to bootstrap only once, using my custom settings. How can I achieve this in a Caddy way?
From what I understand, the order of Provision calls isn’t guaranteed, so I can’t ensure that the observability module is bootstrapped before the others. The only solution I’ve come up with is using a package-level singleton within the module and then loading that module (ctx.LoadModule) in every dependent module, so they’re not reliant on the order of either init or Provision.
what about name conflicts? in case Caddy introduces observability app or somebody else? Can I use prefixes, perhaps something like my_company_observability?
Well, if your app is specific to your company or internal-use, you should name it as such. In theory, an app named “observability” should be the one app to do observability, kind of like how the app named “http” is the one to serve HTTP.
It’s okay if there is a conflict globally, just not in any particular build of Caddy.