Opentelemetry using golang - When to set the exception.escaped Attribute? #3555
-
Here is what we found online: exception.escaped:
My question: When to set in go the exception.escaped Attribute? Let's consider this example: func (a *App) Poll(ctx context.Context) (uint, error) {
_, span := otel.Tracer(name).Start(ctx, "Poll")
defer span.End()
a.l.Print("What Fibonacci number would you like to know: ")
var n uint
_, err := fmt.Fscanf(a.r, "%d\n", &n)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return 0, err
}
// Store n as a string to not overflow an int64.
nStr := strconv.FormatUint(uint64(n), 10)
span.SetAttributes(attribute.String("request.n", nStr))
return n, nil
}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The linked code shows an error, it would not need to include exception semantics. Here is an example of an exception event that is captured on behalf of the user if a span ends with a panic. |
Beta Was this translation helpful? Give feedback.
The linked code shows an error, it would not need to include exception semantics.
Here is an example of an exception event that is captured on behalf of the user if a span ends with a panic.