mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Introduce const for the ss sentry context key
This commit is contained in:
parent
d73f390961
commit
c0e0f8400e
@ -6,6 +6,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SentryCtxKey is a namespace under which we can report arbitrary key-value pairs to
|
||||||
|
// sentry.
|
||||||
|
const SentryCtxKey = "sliding-sync"
|
||||||
|
|
||||||
// GetSentryHubFromContextOrDefault is a version of sentry.GetHubFromContext which
|
// GetSentryHubFromContextOrDefault is a version of sentry.GetHubFromContext which
|
||||||
// automatically falls back to sentry.CurrentHub if the given context has not been
|
// automatically falls back to sentry.CurrentHub if the given context has not been
|
||||||
// attached a hub.
|
// attached a hub.
|
||||||
|
@ -535,7 +535,7 @@ func (p *poller) parseRoomsResponse(res *SyncResponse) {
|
|||||||
const warnMsg = "parseRoomsResponse: prepending state events to timeline after gappy poll"
|
const warnMsg = "parseRoomsResponse: prepending state events to timeline after gappy poll"
|
||||||
logger.Warn().Str("room_id", roomID).Int("prependStateEvents", len(prependStateEvents)).Msg(warnMsg)
|
logger.Warn().Str("room_id", roomID).Int("prependStateEvents", len(prependStateEvents)).Msg(warnMsg)
|
||||||
sentry.WithScope(func(scope *sentry.Scope) {
|
sentry.WithScope(func(scope *sentry.Scope) {
|
||||||
scope.SetContext("sliding-sync", map[string]interface{}{
|
scope.SetContext(internal.SentryCtxKey, map[string]interface{}{
|
||||||
"room_id": roomID,
|
"room_id": roomID,
|
||||||
"num_prepend_state_events": len(prependStateEvents),
|
"num_prepend_state_events": len(prependStateEvents),
|
||||||
})
|
})
|
||||||
|
@ -127,7 +127,7 @@ func NewInviteData(ctx context.Context, userID, roomID string, inviteState []jso
|
|||||||
logger.Error().Str("invitee", userID).Str("room", roomID).Int("num_invite_state", len(inviteState)).Msg(errMsg)
|
logger.Error().Str("invitee", userID).Str("room", roomID).Int("num_invite_state", len(inviteState)).Msg(errMsg)
|
||||||
hub := internal.GetSentryHubFromContextOrDefault(ctx)
|
hub := internal.GetSentryHubFromContextOrDefault(ctx)
|
||||||
hub.WithScope(func(scope *sentry.Scope) {
|
hub.WithScope(func(scope *sentry.Scope) {
|
||||||
scope.SetContext("sliding-sync", map[string]interface{}{
|
scope.SetContext(internal.SentryCtxKey, map[string]interface{}{
|
||||||
"invitee": userID,
|
"invitee": userID,
|
||||||
"room": roomID,
|
"room": roomID,
|
||||||
"num_invite_state": len(inviteState),
|
"num_invite_state": len(inviteState),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user