From 6ad921767f736a08d4a4dfd7256311799f190d4c Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Fri, 26 Jul 2024 11:23:57 -0700 Subject: [PATCH] Allow Pprof and Superisor metrics in standalone mode (#10576) * Allow pprof to run on server with `--disable-agent` * Allow supervisor metrics to run on server with `--disable-agent` Signed-off-by: Derek Nola --- pkg/agent/run.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/agent/run.go b/pkg/agent/run.go index 93b4e27b6230..b0f9398086d6 100644 --- a/pkg/agent/run.go +++ b/pkg/agent/run.go @@ -284,6 +284,18 @@ func RunStandalone(ctx context.Context, cfg cmds.Agent) error { return err } + if nodeConfig.SupervisorMetrics { + if err := metrics.DefaultMetrics.Start(ctx, nodeConfig); err != nil { + return errors.Wrap(err, "failed to serve metrics") + } + } + + if nodeConfig.EnablePProf { + if err := profile.DefaultProfiler.Start(ctx, nodeConfig); err != nil { + return errors.Wrap(err, "failed to serve pprof") + } + } + <-ctx.Done() return ctx.Err() }