getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
38.94k stars 4.18k forks source link

Slack alerts do not include error message #30164

Open adamgsg opened 2 years ago

adamgsg commented 2 years ago

Environment

SaaS (https://sentry.io/)

Version

SaaS

Steps to Reproduce

  1. Create an issue alert that notifies in Slack
  2. Trigger an exception with a custom error message

Expected Result

The Slack notification includes the custom error message

Actual Result

The Slack notification includes the exception text without the message

getsentry-release commented 2 years ago

Routing to @getsentry/ecosystem for triage. ⏲️

manuzope commented 2 years ago

Hi @adamgsg, what do you mean by custom error message and how is it being generated?

adamgsg commented 2 years ago

If I export the issue as JSON, I can see that the field used for Slack Notifications is coming from either:

But the field we want to see in slack is just the ".message" field.

adamgsg commented 2 years ago

I found the place where this is happening: https://github.com/getsentry/sentry/blob/d81985575e1b0a9eebdb65f240db02c6f52ec2ff/src/sentry/integrations/slack/message_builder/issues.py#L74

So this is definitely using the ".metadata.value" field for slack notifications. How can we make it use the ".message" field isntead?

adamgsg commented 2 years ago

If it helps, this is how we're sending our events via the go sdk:

event := sentry.NewEvent()

event.EventID = ...
event.Environment = ...
event.Message = ...
event.User = ...
event.Timestamp = ...
event.ServerName = ...
event.Release = ...
event.Level = ...
event.Logger = ...
event.Tags = ...
event.Platform = ...
event.Contexts  = ...
event.Exception  = ...
event.Fingerprint = ...

hint :=  ...

client.CaptureEvent(event, &hint, nil)
adamgsg commented 2 years ago

Any idea, @manuzope ? This may also be related to a similar issue I just reported in #30566

github-actions[bot] commented 2 years ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

adamgsg commented 2 years ago

bump

kamilogorek commented 2 years ago

@adamgsg if an event contains an exception (those its an "error" event), the message will always be formed out of internal exception type and value. message field is used for exception-less events, so you'd need to skip it if you want provided message to be your "main" value. However, the builder itself doesn't look for the message value as you already pointed out in the link above, so it'd need to be changed there first.

Dhrumil-Sentry commented 1 year ago

Hi @adamgsg , sorry for the delayed response, is there any fields that you wish you could see in the slack alert in addition to the message field?

adamgsg commented 1 year ago

@Dhrumil-Sentry - Yes. If possible, it would be great to include a context field or an "extra data" field in slack alerts, the same way we can currently include tags.

getsantry[bot] commented 1 year ago

Routing to @getsentry/product-owners-alerts for triage ⏲️

getsantry[bot] commented 1 year ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

hubertdeng123 commented 1 year ago

Looks like this shouldn't be staled

olagjo commented 6 months ago

[...] is there any fields that you wish you could see in the slack alert in addition to the message field?

@Dhrumil-Sentry This issue has apparently superseded https://github.com/getsentry/sentry/issues/26006, which tracked the request for "culprit" in Slack messages. So it would be great if culprit would be added to the list of desired fields. It is extremely useful for quickly triaging errors in Slack without having to click each one to go into the web-UI.

For reference, by "culprit" I mean the base level "context/transaction/location/trigger" in the code where the error happened (in our django-app it will typically be the endpoint that was called or the task that was running). It is given pride of place in the web-UI, right next to the actual error-title, and it seems to be at the key "culprit" in the api response.

olagjo commented 4 months ago

@Dhrumil-Sentry I contributed a Pull Request for the culprit part of this issue: https://github.com/getsentry/sentry/pull/72587 It seems like Sentry does accept PRs from outside collaborators, but just let me know if you don't want this one, or how I get a review on it :)

getsantry[bot] commented 4 months ago

Routing to @getsentry/product-owners-settings-integrations for triage ⏲️