The call to health.NewHealthServer(mainPipeline) is placed after mainPipeline.Run(), which does not return in normal circumstances until interrupted. The call to NewHealthServer should be placed before mainPipeline.Run().
Alternatively, perform the mainPipeline.Run() in a separate thread.