diff --git a/changelog/v0.38.3/add-godeltapprof.yaml b/changelog/v0.38.3/add-godeltapprof.yaml new file mode 100644 index 000000000..43535e40b --- /dev/null +++ b/changelog/v0.38.3/add-godeltapprof.yaml @@ -0,0 +1,5 @@ +changelog: + - type: NON_USER_FACING + description: > + "adds godeltapprof to the debug endpoints, to be used with pyroscope or grafana cloud profiler" + skipCI: "false" diff --git a/ci/oss_compliance/osa_provided.md b/ci/oss_compliance/osa_provided.md index 5e6bb0cea..90ffe7d92 100644 --- a/ci/oss_compliance/osa_provided.md +++ b/ci/oss_compliance/osa_provided.md @@ -17,8 +17,10 @@ Name|Version|License [cmp/internal](https://github.com/google/go-cmp)|v0.5.9|BSD 3-clause "New" or "Revised" License [gofuzz/bytesource](https://github.com/google/gofuzz)|v1.2.0|Apache License 2.0 [google/uuid](https://github.com/google/uuid)|v1.3.0|BSD 3-clause "New" or "Revised" License +[pyroscope-go/godeltaprof](https://github.com/grafana/pyroscope-go)|v0.1.6|Apache License 2.0 [josharian/intern](https://github.com/josharian/intern)|v1.0.0|MIT License [json-iterator/go](https://github.com/json-iterator/go)|v1.1.12|MIT License +[klauspost/compress](https://github.com/klauspost/compress)|v1.17.3|Apache License 2.0 [mailru/easyjson](https://github.com/mailru/easyjson)|v0.7.7|MIT License [golang_protobuf_extensions/pbutil](https://github.com/matttproud/golang_protobuf_extensions)|v1.0.4|Apache License 2.0 [modern-go/concurrent](https://github.com/modern-go/concurrent)|v0.0.0-20180306012644-bacd9c7ef1dd|Apache License 2.0 diff --git a/go.mod b/go.mod index 124527606..62518af0a 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,8 @@ require ( github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 github.com/google/gnostic-models v0.6.8 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 + github.com/grafana/pyroscope-go/godeltaprof v0.1.6 github.com/hashicorp/go-multierror v1.1.0 github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 github.com/iancoleman/strcase v0.2.0 @@ -93,6 +94,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/k0kubun/pp v2.3.0+incompatible // indirect + github.com/klauspost/compress v1.17.3 // indirect github.com/lyft/protoc-gen-star v0.6.1 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.7 // indirect diff --git a/go.sum b/go.sum index c084d924a..031bce935 100644 --- a/go.sum +++ b/go.sum @@ -464,6 +464,8 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= +github.com/grafana/pyroscope-go/godeltaprof v0.1.6 h1:nEdZ8louGAplSvIJi1HVp7kWvFvdiiYg3COLlTwJiFo= +github.com/grafana/pyroscope-go/godeltaprof v0.1.6/go.mod h1:Tk376Nbldo4Cha9RgiU7ik8WKFkNpfds98aUzS8omLE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -557,6 +559,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.3 h1:qkRjuerhUU1EmXLYGkSH6EZL+vPSxIrYjLNAK4slzwA= +github.com/klauspost/compress v1.17.3/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= diff --git a/pkg/stats/pprof.go b/pkg/stats/pprof.go index 884859e76..4b2dc6d56 100644 --- a/pkg/stats/pprof.go +++ b/pkg/stats/pprof.go @@ -3,6 +3,8 @@ package stats import ( "net/http" "net/http/pprof" + + deltapprof "github.com/grafana/pyroscope-go/godeltaprof/http/pprof" ) func AddPprof(mux *http.ServeMux) { @@ -11,6 +13,9 @@ func AddPprof(mux *http.ServeMux) { mux.HandleFunc("/debug/pprof/profile", pprof.Profile) mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol) mux.HandleFunc("/debug/pprof/trace", pprof.Trace) + mux.HandleFunc("/debug/pprof/delta_heap", deltapprof.Heap) + mux.HandleFunc("/debug/pprof/delta_threadcreate", deltapprof.Mutex) + mux.HandleFunc("/debug/pprof/delta_block", deltapprof.Block) profileDescriptions["/debug/pprof/"] = `PProf related things:
full goroutine stack dump