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

Add e custom hook to allow to add custom data #299

Open
dnlup opened this issue Nov 18, 2022 · 7 comments
Open

Add e custom hook to allow to add custom data #299

dnlup opened this issue Nov 18, 2022 · 7 comments
Labels
enhancement New feature or request
Milestone

Comments

@dnlup
Copy link
Contributor

dnlup commented Nov 18, 2022

I think it would be nice to expose an option to pass a custom function that can be used to enrich the event with custom data.

@dnlup dnlup added the enhancement New feature or request label Nov 18, 2022
@fernandesGabriel
Copy link

@dnlup would that be something like the previous version that could allow us to run scope.setTag in a custom error handler?

@dnlup
Copy link
Contributor Author

dnlup commented Nov 21, 2022

@fernandesGabriel Yes, I imagined the function could be useful to add more info, like the tags you are mentioning. The only difference with the previous version of the plugin would be that you don't need to implement a custom handler.

@fernandesGabriel
Copy link

That would be perfect @dnlup, I just upgraded to the new version of the plugin, and just noticed that we also have the use case you mention here.

@dnlup dnlup modified the milestones: 5.1.0, 5.0.1 Nov 29, 2022
@dnlup
Copy link
Contributor Author

dnlup commented Dec 16, 2022

@fernandesGabriel I was thinking, wouldn't the beforeSend (the SDK one) option be enough for this use case?

@noahsark769
Copy link

Chiming in that this would be great to have as well! Either a way to expose beforeSend, or a way to expose adding custom context to errors

@noahsark769
Copy link

The workaround for now is to use beforeSend as mentioned above:

void app.register(fastifySentryPlugin, {
  dsn: "...",
  ...,
  beforeSend(event, hint) {
    // Can do custom processing based on `hint.originalException`
    return {
      ...event,
      extra: {
        ...event.extra,
        hello: "world"
      },
    };
  },

That hello: "world" will show up under "Additional Data" in Sentry 👍

@dnlup
Copy link
Contributor Author

dnlup commented Jan 24, 2023

Thanks @noahsark769 for the feedback. So maybe something that allows us to use the scope api instead of manipulating the raw event should be what we are looking for.

@dnlup dnlup added this to the Next milestone Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants