Skip to content

Commit

Permalink
feat: enable pprof profiling (#94)
Browse files Browse the repository at this point in the history
* feat: enable pprof profiling

Signed-off-by: Thomas Belian <[email protected]>

* docs: adjust changelog

Signed-off-by: Thomas Belian <[email protected]>

---------

Signed-off-by: Thomas Belian <[email protected]>
  • Loading branch information
bt909 authored Sep 4, 2024
1 parent f5f1532 commit 8314ea5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased / xxxx-xx-xx

* [FEATURE] enable pprof profiling from Go runtime https://github.com/bt909/imap-mailstat-exporter/pull/94

* [CHORE] update module github.com/prometheus/common to from 0.56.0 to v0.57.0 https://github.com/bt909/imap-mailstat-exporter/pull/91
* [CHORE] update module github.com/prometheus/common to from 0.57.0 to v0.58.0 https://github.com/bt909/imap-mailstat-exporter/pull/92
* [CHORE] update update module github.com/prometheus/exporter-toolkit from v0.11.0 to v0.12.0 https://github.com/bt909/imap-mailstat-exporter/pull/93
Expand Down
6 changes: 6 additions & 0 deletions cmd/imap-mailstat-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main

import (
"net/http"
"net/http/pprof"
"os"

"github.com/alecthomas/kingpin/v2"
Expand Down Expand Up @@ -67,6 +68,11 @@ func main() {
reg.MustRegister(d)

mux := http.NewServeMux()
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)
promHandler := promhttp.HandlerFor(reg, promhttp.HandlerOpts{})
mux.Handle(*metricsPath, promHandler)
if *metricsPath != "/" {
Expand Down

0 comments on commit 8314ea5

Please sign in to comment.