diff --git a/.gitignore b/.gitignore index 578eac6..813e515 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ littleauth +profiles/*.pprof diff --git a/Makefile b/Makefile index 1a03083..763076a 100644 --- a/Makefile +++ b/Makefile @@ -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 $@ diff --git a/merged.pprof b/merged.pprof new file mode 100644 index 0000000..dc34523 Binary files /dev/null and b/merged.pprof differ diff --git a/pgo.go b/pgo.go new file mode 100644 index 0000000..b9c8dbc --- /dev/null +++ b/pgo.go @@ -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") + } + }() +} diff --git a/profiles/.gitkeep b/profiles/.gitkeep new file mode 100644 index 0000000..e69de29