Skip to content

Commit

Permalink
Include mutexes in spans
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Feb 26, 2024
1 parent dcb8854 commit 8ccb018
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sync3/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (c *Conn) isOutstanding(pos int64) bool {
// client. It will NOT be reported to Sentry---this should happen as close as possible
// to the creation of the error (or else Sentry cannot provide a meaningful traceback.)
func (c *Conn) OnIncomingRequest(ctx context.Context, req *Request, start time.Time) (resp *Response, herr *internal.HandlerError) {
ctx, span := internal.StartSpan(ctx, "OnIncomingRequest.AcquireMutex")
c.cancelOutstandingRequestMu.Lock()
if c.cancelOutstandingRequest != nil {
c.cancelOutstandingRequest()
Expand All @@ -149,6 +150,7 @@ func (c *Conn) OnIncomingRequest(ctx context.Context, req *Request, start time.T
// it's intentional for the lock to be held whilst inside HandleIncomingRequest
// as it guarantees linearisation of data within a single connection
defer c.mu.Unlock()
span.End()

isFirstRequest := req.pos == 0
isRetransmit := !isFirstRequest && c.lastClientRequest.pos == req.pos
Expand Down

0 comments on commit 8ccb018

Please sign in to comment.