Skip to content

Commit add28c2

Browse files
committed
fix(adapter): start pprof server when profiling is enabled
The eventing adapter framework creates and configures a ProfilingServer but never calls ListenAndServe, so the profiling port is never bound even when runtime-profiling is set to enabled in the observability ConfigMap. Start the server conditionally based on the initial config, consistent with the adapter's static observability config model. Fixes #9007 Signed-off-by: Akshay Pant <akpant@redhat.com>
1 parent 263a3a5 commit add28c2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

pkg/adapter/v2/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ func MainWithInformers(ctx context.Context, component string, env EnvConfigAcces
284284
}()
285285
}
286286

287+
wg.Add(1)
288+
go func() {
289+
defer wg.Done()
290+
if err := pprof.ListenAndServe(); err != nil {
291+
logger.Warnw("Profiling server shut down", zap.Error(err))
292+
}
293+
}()
294+
287295
// Finally start the adapter (blocking)
288296
if err := adapter.Start(ctx); err != nil {
289297
logger.Fatalw("Start returned an error", zap.Error(err))

0 commit comments

Comments
 (0)