Sentry Tracing Identifier

This commit is contained in:
Maximilian Paß
2023-02-03 00:36:13 +00:00
parent a9581ac1d9
commit 2650efbb38
6 changed files with 55 additions and 41 deletions

View File

@ -1,6 +1,7 @@
package logging
import (
"context"
"github.com/getsentry/sentry-go"
"github.com/sirupsen/logrus"
)
@ -36,3 +37,10 @@ func (hook *SentryHook) Levels() []logrus.Level {
logrus.WarnLevel,
}
}
func StartSpan(op, description string, ctx context.Context, callback func(context.Context)) {
span := sentry.StartSpan(ctx, op)
span.Description = description
defer span.Finish()
callback(span.Context())
}