Skip to content

Commit

Permalink
Emit the error code and type to the tracing span for inbound calls (#903
Browse files Browse the repository at this point in the history
)

* Emit the error code and type to the tracing span for inbound calls

* Update Inbound Span error type and code fields and emit tags instead of logs

* Change Error Type Span Tag key to rpc.tchannel.error_type
  • Loading branch information
deepanshumehndiratta authored Aug 29, 2023
1 parent e0354b9 commit 628e1b3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ import (
"golang.org/x/net/context"
)

const (
systemErrorType = "system"
appErrorType = "application"
)

var errInboundRequestAlreadyActive = errors.New("inbound request is already active; possible duplicate client id")

// handleCallReq handles an incoming call request, registering a message
Expand Down Expand Up @@ -415,6 +420,13 @@ func (response *InboundCallResponse) doneSending() {
if span := response.span; span != nil {
if response.applicationError || response.systemError {
ext.Error.Set(span, true)
errorType := appErrorType
if response.systemError {
errorType = systemErrorType
// if the error is a system error, set the error code in span log
span.SetTag("rpc.tchannel.system_error_code", GetSystemErrorCode(response.err))
}
span.SetTag("rpc.tchannel.error_type", errorType)
}
span.FinishWithOptions(opentracing.FinishOptions{FinishTime: now})
}
Expand Down

0 comments on commit 628e1b3

Please sign in to comment.