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())
}

View File

@ -91,7 +91,8 @@ func (w *Ls2JsonWriter) initializeJSONObject() (count int, err error) {
err = fmt.Errorf("could not write to target: %w", err)
} else {
w.jsonStartSent = true
w.sentrySpan = sentry.StartSpan(w.Ctx, "Forwarding")
w.sentrySpan = sentry.StartSpan(w.Ctx, "nullio.init")
w.sentrySpan.Description = "Forwarding"
}
}
return count, err