Performance monitoring in Sentry

Hi Folks, How can I implement performance monitoring with Sentry. I went through the strapi-plugin-sentry plugin, but looks like it is used only for tracking errors.

I even tried by implementing this in ./config/plugins.js

sentry: {
    dsn: env('SENTRY_DSN'),
    sendMetadata: true,
    init: {
      integrations: [new Sentry.Integrations.Http({ tracing: true })],
      tracesSampleRate: 1.0,
    },
  },

But, I don’t see any requests being made to sentry.

I created custom middleware in Strapi and sent traces by following Koa | Sentry Documentation

Hi @Sujay_Prabhu would you mind sharing some code on how you have implemented your custom middleware please?

For Strapi v4:

For Strapi v3:

In config/middleware.js

module.exports = {
  settings: {
    sentry: {
      enabled: true,
    },
  },
};

middlewares/sentry/index.js

Sentry.init({...params})

module.exports = (strapi) => {
  return {
    initialize() {
      strapi.app.use(async (ctx, next) => {
        try {
          await next();
        } catch (error) {
          Sentry.captureException(error);
          throw error;
        }
      });
    },
  };
};
1 Like

hi @Sujay_Prabhu, strapi v4 it broke, and in the context request there are no headers for sentry-tracing.
Is there any solution?

My code like that code

Hi @Ahmed_Boghdady
Unfortunately I don’t have solution for this yet. Looks like @strapi/plugin-sentry plugin is the cause of the issue