Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting packet.Culprit = err.Error() overrides error message #21

Open
njern opened this issue Nov 14, 2016 · 7 comments
Open

Setting packet.Culprit = err.Error() overrides error message #21

njern opened this issue Nov 14, 2016 · 7 comments
Assignees

Comments

@njern
Copy link

njern commented Nov 14, 2016

When enabling stack traces, logrus_sentry sets

packet.Culprit = err.Error()

On line 140.

This changes the default behaviour, where the logged error message is the "title" in the Sentry dashboard, to instead making the error into the title.

I suggest retaining the default behaviour, whether the uses wants to include a stack trace or not.

@evalphobia evalphobia self-assigned this Nov 21, 2016
@evalphobia
Copy link
Owner

Available options;

  • a) Add an flag into hook struct and if it is true then override packet.Culprit
  • b) Add special field like culprit and if it is set then override packet.Culprit
  • c) Set packet.Culprit when entry.Message is empty string

@belak Any thoughts?

@belak
Copy link
Contributor

belak commented Nov 27, 2016

I'm not particularly sure what the best solution would be... my main problem has been that all (unrelated) errors are getting logged (and grouped) under the place where they're logged, rather than by the error itself... And I'm not sure how much of that is because we're stuck on a super old version of sentry and how much is the library. We're part-way through that transition, but I'm afraid my comments won't be as useful until then.

At least for my use case, the optimal method would be to group by the Message, and then by err.Error() but I'm not sure how to accomplish that.

Sorry, that rambled a bit more than I wanted but I think you get the general idea.

@flimzy
Copy link
Contributor

flimzy commented Dec 15, 2016

I think I'm in favor of option #C.

Using err.Error() has made our logs much harder for us mere humans to read quickly.

@flimzy
Copy link
Contributor

flimzy commented Dec 15, 2016

In the end, though, I think this is a bug/misfeature in Sentry, not in this library.

@flimzy
Copy link
Contributor

flimzy commented Dec 15, 2016

Upon further reading, it does seem that logrus_sentry is improperly assigning culprit. It's intended to be a function name, not human readable text. See here.

Even so, that doesn't address the underlying issue; logrus_sentry could easily set it to the function which errored, and it would still override the 'message' as the page title.

@belak
Copy link
Contributor

belak commented Dec 15, 2016

I did this a while back and we're (currently) using this internally: belak-forks@060021c

It seems to work pretty well because (at least for us) we use static messages and store all changing information in the fields... however this has the disadvantage that when looking at logs without the fields, they're pretty worthless.

@flimzy
Copy link
Contributor

flimzy commented Dec 15, 2016

Indeed, any change to this functionality will likely break someone. I propose that any change is done as an option, with the existing ("broken") behavior as the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants