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

Enable pprof in debug mode #132

Merged
merged 13 commits into from
Jun 14, 2024
5 changes: 5 additions & 0 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package main
import (
"context"
"encoding/json"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"syscall"
Expand All @@ -27,6 +29,9 @@ func main() {

if cfg.DebugMode {
log.EnableDebug()
go func() {
http.ListenAndServe(config.AppDebugAddr, nil)
}()
log.Info("Debug mode enabled")
}
if cfg.UseSyslog {
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "time"
const (
AppFullName = "DigitalOcean Droplet Agent (code name: DOTTY)"
AppShortName = "Droplet Agent"
AppDebugAddr = "127.0.0.1:304"
)

const (
Expand Down
Loading