Skip to content

Move enterprise setup into setup hook

Warren Gifford requested to merge fix-enterprise-tracing-startup into master

Created by: efritz

Ok so this took a long while to track down. The current situation is that the opentracing tracer is not set up properly for the code intel-based components of the enterprise frontend. This causes basically every codeintel-related span in the frontend to throw an error from inside the jaeger-client.

The global tracer that wraps the codeintel db, bundle manager, and api is initialized here as part of the enterprise frontend main function. This, by the design of the current architecture, happens prior to any non-enterprise frontend setup. This includes things like db.Init() and env.Lock(), which in other services are done as early as possible.

I didn't notice until I tracked down this issue, but we swap out the opentracing global singleton to our own swappable tracer version (in internal/trace). This doesn't happen until later in the frontend setup process.

This PR changes the enterprise setup process so that the db, config, and tracing initialization are done first, then the enterprise setup, then the remaining frontend bootstrap work. I feel like this is a better separation, and also ensures that we don't have to check for db double-initialization (nor do we have to expose the db setup function to be called earlier).

Alternatively, I tried moving the tracing code earlier in the process, but it gets locked up by something, but I didn't investigate too hard.

Note to reviewers: Please review with ignore whitespace - there are no non-trivial changes to enterprise/cmd/frontend/main.go, but it appears like there is due to indentation.

Merge request reports

Loading