mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-08 14:43:09 -06:00
Add some NATS breadcrumbs
This commit is contained in:
parent
107b90e19a
commit
291dd74243
|
|
@ -3,6 +3,7 @@ package jetstream
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/getsentry/sentry-go"
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
|
|
@ -75,6 +76,17 @@ func JetStreamConsumer(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
msg := msgs[0]
|
msg := msgs[0]
|
||||||
|
sentry.AddBreadcrumb(&sentry.Breadcrumb{
|
||||||
|
Type: "nats",
|
||||||
|
Category: "jetstream",
|
||||||
|
Data: map[string]interface{}{
|
||||||
|
"subject": subj,
|
||||||
|
"durable": durable,
|
||||||
|
"header": msg.Header,
|
||||||
|
},
|
||||||
|
Message: string(msg.Data),
|
||||||
|
Timestamp: time.Now(),
|
||||||
|
})
|
||||||
if err = msg.InProgress(nats.Context(ctx)); err != nil {
|
if err = msg.InProgress(nats.Context(ctx)); err != nil {
|
||||||
logrus.WithContext(ctx).WithField("subject", subj).Warn(fmt.Errorf("msg.InProgress: %w", err))
|
logrus.WithContext(ctx).WithField("subject", subj).Warn(fmt.Errorf("msg.InProgress: %w", err))
|
||||||
sentry.CaptureException(err)
|
sentry.CaptureException(err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue