Add link to Sentry event based on tag

We just started tagging our Sentry events with a unique request id so that we can link them back to our request logs.

Is there any way to add a link to our Sentry UI that uses that tag value to create the link? I’m thinking something like the link to a ticket that the JIRA integration provides, only at the event level.

This is exactly what I’m trying to do, any success @kalifg ?
(just realised this was 4 years ago, but I’ll keep my comment just in case)

No I did not, sorry

Too bad ! I’ll keep looking into it and post if I have a solution

In beforeSend callback you do get event object which has event_id field. You could use that.

// js example
Sentry.init({
    beforeSend: (event, hint) => {
        console.log(event.event_id);
        return event;
    },
});

well, that’s a nice idea, I wanted to add a clickable link on the event page (like the new integrations).
But adding the link ,as plain text, in the additional data should suffice until I find a better solution ! thanks for sharing :ok_hand:

1 Like

here’s how I did it

Sentry.init({
  dsn: ...,
  beforeSend: event => {
    if (event.tags && event.tags['my-tag']) {
      event.extra = {
        ...event.extra,
        MyUrl: `https://some-link.com/query=@id:${String(event.tags['my-tag'])}`,
      };
    }
    return event;
  },
});
1 Like

nice one!

If you want 1 event per 1 issue like structure then you could SDK level fingerprinting but I’m not sure if it’s a good approach.

beforeSend: (event, hint) => {
    event['fingerprint'] = [event.event_id];
    return event;
},

Not sure if it’s a good approach but I asked this in this discourse. Let’s see.

actually the default fingerprint rules for sentry are pretty accurate,
but I do have some specific events that I want grouped together, and for that I defined the rules directly in Sentry ( Settings → projects → project-name → Issue grouping → fingerprint rules )

1 Like