Skip to content

Commit f608619

Browse files
committed
EndSpanErr span nil check + typo fix
1 parent 5f8e36a commit f608619

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

aibtrace/aibtrace.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ func TraceInterceptionAttributesFromContext(ctx context.Context) []attribute.Key
3737
}
3838

3939
func EndSpanErr(span trace.Span, err *error) {
40+
if span == nil {
41+
return
42+
}
43+
4044
if err != nil && *err != nil {
4145
span.SetStatus(codes.Error, (*err).Error())
4246
}

interception.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ type Interceptor interface {
3030
ProcessRequest(w http.ResponseWriter, r *http.Request) error
3131
// Specifies whether an interceptor handles streaming or not.
3232
Streaming() bool
33-
34-
// TraceAttributes returns tacing attributes for this [Inteceptor]
33+
// TraceAttributes returns tracing attributes for this [Interceptor]
3534
TraceAttributes(context.Context) []attribute.KeyValue
3635
}
3736

0 commit comments

Comments
 (0)