Sentry: [Feature Request] Auto sort breadcrumbs by default / add options

Created on 20 Apr 2018  路  9Comments  路  Source: getsentry/sentry

I'm not reporting a bug but I have also not found a better channel so I figured I'd put it here.

In my app configuration I'm manually changing every console breadcrumb because I need to parse some data. I keep this data separately in my app and I'm also capturing when the event occured so I have correct timestamp.

Once I manually invoke Raven.captureException, I go through my recorded data (basically console.logs. At this moment I loop through them, do some adjustments and perform Raven.captureBreadcrumb where I also add timestamp parameter. However in the web interface of Sentry the order of the breadcrumbs is not correct:

You can see that my manually captured breadcrumbs are all placed in the end even though the timestamp is correct. Logically they should be placed right after the corresponding UI breadcrumbs.

I ended up sorting the breadcrumbs manually in my dataCallback function:

Raven.config({
  dataCallback: (data) => {
    if (data.breadcrumbs && data.breadcrumbs.values) {
      const sortedBreadcrumbValues = data.breadcrumbs.values.sort((prev, next) => {
        if (prev.timestamp > next.timestamp) {
          return 1
        }
        if (prev.timestamp < next.timestamp) {
          return -1
        }
        return 0
      })
     data.breadcrumbs.values = sortedBreadcrumbValues
    }
  return data
  }
})

I was kind of expecting that this would happen automatically. I can't imagine a reason why you would not want the breadcrumbs to be sorted temporaly. I agree that this is not a big deal but it'd be cool if you could add option to config autoSortBreadcrumbs at least.

Issues UI

All 9 comments

Hi, is anyone looking into this? What's the point of having breadcrumbs when they are not even arranged in order? How is that a good debugging experience for the developer?

@priscilawebdev is this something you've worked on recently?

yes, I worked on it a few months ago ... I will check the issue 馃槈

Hi @comatory - As we don't sort breadcrumbs on the client-side, I reached out to our SDK team, and turns out that timestamp is informational only, and not related to the order of operations

@StarryFire if the breadcrumbs are out of order, then there's an issue in the SDK that should be fixed. If you are using Raven I am sorry to say that it's not supported for almost 2 years now

Hi @comatory - As we don't sort breadcrumbs on the client-side, I reached out to our SDK team, and turns out that timestamp is informational only, and not related to the order of operations

Hm I see. However the logical conclusion (and I think I'm not the only one) led me to believe that since this information is displayed in the dashboard, it would make sense some kind of ordering would be preserved.

I'd propose either:

  1. Mention in the documentation that the timestamp on breadcrumbs is just an information and if you want to sort it, you have to do it yourself.
  2. Add ability in the SDK that would sort the breadcrumbs for you based on timestamps.

Yes I realize Raven is not supported as well but I haven't received response for two years and back then Raven was supported.

Hello @comatory yes I agree with you, but please see my comments on your proposals below:

1 - Sure thing! I will do that 馃槈
2 - Relay could do that easily. However, if we do that, we may accidentally cover some SDK issues.
For example, we had one issue a few months ago, where breadcrumb timestamps were messed up, but the order was correct. If we sort them, then it'd never surface, because it'd display "kinda correct".

Because of that, we prefer to don't do that now.

Closing the issue as we added the information discussed above to our documentation. Thanks a lot for reporting and working with us @comatory and please reply here if you think there's more to be done.

You can find the info about the timestamp through this link https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/ 馃槈

I think mentioning it in callout/info box is visible and straight to the point.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benvinegar picture benvinegar  路  4Comments

fatagun picture fatagun  路  4Comments

sul4bh picture sul4bh  路  3Comments

dcramer picture dcramer  路  4Comments

dmnd picture dmnd  路  4Comments