packagehelpersimport("context""go.uber.org/fx")typeMetricsCtxcontext.Context// LifecycleCtx creates a context which will be cancelled when lifecycle stops//// This is a hack which we need because most of our services use contexts in a// wrong wayfuncLifecycleCtx(mctxMetricsCtx,lcfx.Lifecycle)context.Context{ctx,cancel:=context.WithCancel(mctx)lc.Append(fx.Hook{OnStop:func(_context.Context)error{cancel()returnnil},})returnctx}