From caba76e1329660c1c136130e5619626c308e514f Mon Sep 17 00:00:00 2001 From: Hank Donnay Date: Thu, 6 Jul 2023 14:17:01 -0500 Subject: [PATCH] introspection: add delta pprof endpoints This adds the delta pprof endpoints that pyroscope can make use of. Signed-off-by: Hank Donnay --- go.mod | 1 + go.sum | 2 ++ introspection/server.go | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/go.mod b/go.mod index 3eef267c53..29b290a4d4 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/klauspost/compress v1.16.7 github.com/ldelossa/responserecorder v1.0.2-0.20210711162258-40bec93a9325 github.com/prometheus/client_golang v1.16.0 + github.com/pyroscope-io/godeltaprof v0.1.1 github.com/quay/clair/config v1.3.0 github.com/quay/claircore v1.5.8 github.com/quay/zlog v1.1.4 diff --git a/go.sum b/go.sum index c8b7e78fc9..2e86870e06 100644 --- a/go.sum +++ b/go.sum @@ -183,6 +183,8 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/pyroscope-io/godeltaprof v0.1.1 h1:+Mmi+b9gR3s/qufuQSxOBjyXZR1fmvS/C12Q73PIPvw= +github.com/pyroscope-io/godeltaprof v0.1.1/go.mod h1:psMITXp90+8pFenXkKIpNhrfmI9saQnPbba27VIaiQE= github.com/quay/alas v1.0.1 h1:MuFpGGXyZlDD7+F/hrnMZmzhS8P2bjRzX9DyGmyLA+0= github.com/quay/alas v1.0.1/go.mod h1:pseepSrG9pwry1joG7RO/RNRFJaWqiqx9qeoomeYwEk= github.com/quay/clair/config v1.3.0 h1:UqJIwvgHaWj6yTWrpVnYnlEIKcVYxJItlEF2EsCnw5s= diff --git a/introspection/server.go b/introspection/server.go index 6c0485a2bb..2ff8ad1c07 100644 --- a/introspection/server.go +++ b/introspection/server.go @@ -9,6 +9,7 @@ import ( "time" "github.com/prometheus/client_golang/prometheus/promhttp" + deltapprof "github.com/pyroscope-io/godeltaprof/http/pprof" "github.com/quay/clair/config" "github.com/quay/zlog" "go.opentelemetry.io/otel" @@ -216,6 +217,9 @@ func (i *Server) withDiagnostics(_ context.Context) error { i.HandleFunc("/debug/pprof/profile", pprof.Profile) i.HandleFunc("/debug/pprof/symbol", pprof.Symbol) i.HandleFunc("/debug/pprof/trace", pprof.Trace) + i.HandleFunc("/debug/pprof/delta_heap", deltapprof.Heap) + i.HandleFunc("/debug/pprof/delta_block", deltapprof.Block) + i.HandleFunc("/debug/pprof/delta_mutex", deltapprof.Mutex) return nil }