Skip to content

Commit

Permalink
Add pprof annotations to roomserver worker goroutines
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Dec 16, 2024
1 parent 1f69f34 commit f0b9ac1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions roomserver/internal/input/input_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/json"
"errors"
"fmt"
"runtime/pprof"
"time"

"github.com/neilalexander/harmony/roomserver/storage/tables"
Expand Down Expand Up @@ -116,6 +117,10 @@ func (r *Inputer) processRoomEvent(
})
}

// Set goroutine labels, useful for pprof CPU profiles, useful for CPU
// pprof profiles to find out where time is being spent.
pprof.SetGoroutineLabels(context.WithValue(ctx, "room_id", event.RoomID().String()))

Check failure on line 122 in roomserver/internal/input/input_events.go

View workflow job for this annotation

GitHub Actions / Linting

SA1029: should not use built-in type string as key for value; define your own type to avoid collisions (staticcheck)

// Don't waste time processing the event if the room doesn't exist.
// A room entry locally will only be created in response to a create
// event.
Expand Down

0 comments on commit f0b9ac1

Please sign in to comment.