mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-18 10:22:31 +00:00
fix tracing/statusFromError
This commit is contained in:
@@ -5,9 +5,8 @@ import (
|
||||
"strconv"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/grpc"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
)
|
||||
|
||||
@@ -41,10 +40,8 @@ func (s *Span) SetStatusByError(err error) {
|
||||
}
|
||||
|
||||
func statusFromError(err error) trace.Status {
|
||||
if statusErr, ok := status.FromError(err); ok {
|
||||
return trace.Status{Code: int32(statusErr.Code()), Message: statusErr.Message()}
|
||||
}
|
||||
return trace.Status{Code: int32(codes.Unknown), Message: "Unknown"}
|
||||
code, msg, _ := grpc.Extract(err)
|
||||
return trace.Status{Code: int32(code), Message: msg}
|
||||
}
|
||||
|
||||
// AddAnnotation creates an annotation. The annotation will not be added to the tracing use Annotate(msg) afterwards
|
||||
|
Reference in New Issue
Block a user