Skip to content

Commit

Permalink
Merge pull request #57 from tulip/tory.add-pprof-endpoint
Browse files Browse the repository at this point in the history
Add pprof endpoints
  • Loading branch information
torywheelwright committed Mar 28, 2024
2 parents 0867d6f + 8bba4f8 commit bf16521
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

buildGoModule {
pname = "oplogtoredis";
version = "3.1.0";
version = "3.2.0";
src = builtins.path { path = ./.; };

postInstall = ''
'';

# update: set value to an empty string and run `nix build`. This will download Go, fetch the dependencies and calculates their hash.
vendorHash = "sha256-ceToA2DC1bhmg9WIeNSAfoNoU7sk9PrQqgqt5UbpivQ=";

nativeBuildInputs = [ installShellFiles ];
doCheck = false;
doInstallCheck = false;
Expand Down
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
stdlog "log"
"net/http"
"net/http/pprof"
"os"
"os/signal"
"strings"
Expand Down Expand Up @@ -257,5 +258,11 @@ func makeHTTPServer(clients []redis.UniversalClient, mongo *mongo.Client) *http.

mux.Handle("/metrics", promhttp.Handler())

mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)

return &http.Server{Addr: config.HTTPServerAddr(), Handler: mux}
}

0 comments on commit bf16521

Please sign in to comment.