-
Notifications
You must be signed in to change notification settings - Fork 246
Missing stack trace when using the logrus integration #677
Description
Summary
When using the logrus approach to report Sentry issues (such as in the example), the issues appear on Sentry but they don't have the nicely formatted stack trace, and the JSON event is missing the frames property which I assume is related.
If I try to use the basic example with sentry.CaptureException(err), the stack trace shows up and the JSON object has the frames.
Steps To Reproduce
package main
import (
"errors"
"time"
"github.com/getsentry/sentry-go"
sentrylogrus "github.com/getsentry/sentry-go/logrus"
log "github.com/sirupsen/logrus"
)
func main() {
sentryLevels := []log.Level{log.ErrorLevel, log.FatalLevel, log.PanicLevel}
sentryHook, _ := sentrylogrus.New(sentryLevels, sentry.ClientOptions{
Dsn: "<DSN>",
Debug: true,
AttachStacktrace: true,
})
log.AddHook(sentryHook)
defer sentryHook.Flush(2 * time.Second)
fakeErr := errors.New("fake error object")
log.WithError(fakeErr).Error("test")
// log.WithError(fakeErr).Error(fakeErr) // this does not help either
}Expected Behavior
This is the Sentry issue in JSON format, it's missing the frames property next to type and value.
"exception": {
"values": [
{
"type": "error",
"value": "fake error object"
}
]
},Screenshots
What I get:
What I expect to get (as with sentry.CaptureException):
Environment
SDK
sentry-goversion: 0.22.0- Go version: 1.20
- Using Go Modules? [yes/no] yes
Sentry
- Using hosted Sentry in sentry.io? [yes/no] yes
- Using your own Sentry installation? Version: //
- Anything particular to your environment that could be related to this issue? //
Additional context
From what I managed to find while debugging, the problem comes from the fact that when using Sentry with logrus, the ExtractStackTrace function exits (which is expected I assume with Go's standard errors) and the NewStackTrace function is never called, but it is called when using plain sentry.CaptureException even though I am using Go's standard errors. Any particular reason why the behaviour is different? Am I missing something to have the stack trace frames generated when using Sentry with logrus?
Metadata
Metadata
Assignees
Labels
Fields
Give feedbackProjects
Status

