Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bake in pprof data from production to optimise hot paths #7

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
littleauth
profiles/*.pprof
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go_build_cmd ?= CGO_ENABLED=1 go build -ldflags="-s -w" -trimpath -race
go_build_cmd ?= CGO_ENABLED=1 go build -ldflags="-s -w" -trimpath -race -pgo merged.pprof

littleauth: *.go go.*
$(go_build_cmd) -o $@
Expand Down
Binary file added merged.pprof
Binary file not shown.
16 changes: 16 additions & 0 deletions pgo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"net/http"
_ "net/http/pprof" //#nosec: G108
"os"
)

func init() {
go func() {
if os.Getenv("COLLECT_METRICS") == "yes" {
//#nosec: G114
print(http.ListenAndServe("localhost:6060", nil), "\n")
}
}()
}
Empty file added profiles/.gitkeep
Empty file.