17 lines
342 B
Go
17 lines
342 B
Go
package utils
|
|
|
|
import (
|
|
"context"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
"go.opentelemetry.io/otel/codes"
|
|
"go.opentelemetry.io/otel/trace"
|
|
)
|
|
|
|
func HandleError(ctx context.Context, span trace.Span, logger *log.Entry, error error) error {
|
|
logger.Error(error)
|
|
span.RecordError(error)
|
|
span.SetStatus(codes.Error, error.Error())
|
|
return error
|
|
}
|