Skip to content

Setup monitoring earlier in Server construction

Jeremiah Bonney requested to merge jbonney/setup-monitoring-early into master

Description

This MR reorders some of the setup that happens when creating a Server class, specifically to have the monitoring and logging setup before anything else. This fixes an issue where metrics were added to AuthMetadataServerInterceptor, but since that is created before monitoring is set up the following message is printed in the log:

2021-01-12 17:06:12,401:[    buildgrid.server._authentication][ INFO][MainThread]: Replacing existing JWKs set, with one fetched at time: [2021-01-12 17:06:12.401246+00:00] from url: [https://foo.bar.com:5432/.well-known/jwks.json
2021-01-12 17:06:12,401:[         buildgrid.server.monitoring][ INFO][MainThread]: get_monitoring_bus() was called before setup_monitoring_bus; no metrics will be published.

Which means that this metric was dropped. By moving the metric initialization earlier, this metric will get published properly.

Merge request reports

Loading