Skip to content

Commit

Permalink
add pprof to load test cli
Browse files Browse the repository at this point in the history
  • Loading branch information
abelanger5 committed Feb 5, 2025
1 parent 34e8e00 commit e65e537
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/loadtest/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ package main

import (
"log"
"os"
"time"

"github.com/rs/zerolog"
"github.com/spf13/cobra"

"github.com/hatchet-dev/hatchet/pkg/config/shared"
"github.com/hatchet-dev/hatchet/pkg/logger"

"net/http"
_ "net/http/pprof"
)

var l zerolog.Logger
Expand Down Expand Up @@ -36,6 +40,13 @@ func main() {
"loadtest",
)

// enable pprof if requested
if os.Getenv("PPROF_ENABLED") == "true" {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
}

if err := do(duration, events, delay, wait, concurrency, workerDelay, slots, failureRate, payloadSize); err != nil {
log.Println(err)
panic("load test failed")
Expand Down

0 comments on commit e65e537

Please sign in to comment.