-
Notifications
You must be signed in to change notification settings - Fork 246
Closed
Labels
FeatureIssue typeIssue type
Description
Summary
A way to override the hub stored in the gin.Context.
Motivation
This request comes after I ran into an issue where I want to use a Copy() of the gin Context for a goroutine. This function task takes that gin Context clone and might have to report errors through sentry. Documentation on goroutines indicates that we should use a local hub to avoid race conditions when modifying the Scope.
The idea is to shield the implementation of the potentially goroutined function from having to know it is running in a goroutine and having to create its own local hub. Ideally, that function would be able to use GetHubFromContext normally and the local hub would be injected seamlessly.
Additional Context
It would be useful to be able to do the following:
for _, item := range items {
ctxClone := ctx.Copy()
sentrygin.SetHubInContext(ctxClone, sentrygin.GetHubFromContext(ctx).Clone())
go doSomething(ctxClone, item, resultChannel)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FeatureIssue typeIssue type
Fields
Give feedbackNo fields configured for issues without a type.