Skip to content

Commit cc071a6

Browse files
authored
Fix rollbar projects frames #43
This PR fixes how the stacktrace is presented to the rollbar service and thus the ui. If we keep the SetServerRoot line all the frames are marked as non-project frame. Once we get rid of the line rollbar correctly shows us the stack frame as if it belongs to the project. I suspect this has to do with projects using pkg (and pkg itself when running examplelog) being built in with go modules enabled. examplelog is also updated to be more inline with the "proper" way to use log: - defer the `Close` right after checking error returned by `Init` - Use the correct package name when calling `Package`
2 parents e615d5c + 9b96ea8 commit cc071a6

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

cmd/examplelog/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ func main() {
1919
if err != nil {
2020
panic(err)
2121
}
22+
defer l.Close()
2223

23-
ll := l.Package("log")
24+
ll := l.Package("cmd/examplelog")
2425
ll.With("debug", true).Debug("hello this is a debug message")
2526
ll.With("debug", false).Info("hello this is a Info message")
2627

@@ -31,5 +32,4 @@ func main() {
3132
ll.Error(errors.WithMessage(err, "error with an extra WithMessage"))
3233

3334
helpfulWrapper(ll, "this is being called via helpfulWrapper")
34-
l.Close()
3535
}

log/internal/rollbar/rollbar.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func Setup(l *zap.SugaredLogger, service string) func() {
2828

2929
v := getVersion()
3030
rollbar.SetCodeVersion(v)
31-
rollbar.SetServerRoot("/" + service)
3231

3332
enable := true
3433
if os.Getenv("ROLLBAR_DISABLE") != "" {

0 commit comments

Comments
 (0)