sentry-go
sentry-go copied to clipboard
Adding context.Context hub extractor for sentry-logrus integration
Ho-ho-ho!
Problem: When using sentry-logrus integration, it's no option for capturing events with connected traces, 'cause scopes between global sentry and hook integration isn't same.
Probably solution:
There no way to "just add hook.NewFromHub(levels, hub)", -> it will race condition.
Solution:
Adding custom extraction for sentry.Hub from current context (with using logrus.WithContext(ctx) and injected sentry.Hub to ctx via SetHubOnContext, or any middlewares, or smth else) solves this clearly.
Current change doesn't broke current API, but it gives ability for resolving explained problem.
P.S.: Probably, test isn't clearly, but I not found any more clear solution for test this, whithout more API changing
Hello, @cleptric. Any comments for this? Do I need to resolve typo, or smth else?
@090809 Thanks for the contribution. We are currently busy with other things but will take a look as soon as we wrap up.