Skip to content

Conversation

@JPeer264
Copy link
Member

closes #18868
closes JS-1498

ATM it is not possible to map custom levels to OpenTelemetry levels. The option customLevelMap has been added to make this possible. Which means that custom levels would have never been send to Sentry, as they were not mapped correctly.

Now when there are custom levels it can be used like this:

const customLevels = {
  levels: {
    customCritical: 0,
    customNotice: 2,
  },
};

const SentryWinstonTransport = Sentry.createSentryWinstonTransport(Transport, {
  customLevelMap: {
    customCritical: 'fatal',
    customNotice: 'info',
  },
});

const mappedLogger = winston.createLogger({
  levels: customLevels.levels,
  level: 'customNotice', // this needs to be added due to https://github.com/winstonjs/winston/issues/1491
  transports: [new SentryWinstonTransport()],
});

Merge checklist

  • Sentry Docs update issue has been created

@JPeer264 JPeer264 requested review from nicohrubec and s1gr1d January 21, 2026 13:56
@JPeer264 JPeer264 self-assigned this Jan 21, 2026
@linear
Copy link

linear bot commented Jan 21, 2026

@github-actions
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 11,426 - 8,959 +28%
GET With Sentry 2,048 18% 1,585 +29%
GET With Sentry (error only) 7,704 67% 6,016 +28%
POST Baseline 1,204 - 1,171 +3%
POST With Sentry 600 50% 570 +5%
POST With Sentry (error only) 1,075 89% 1,030 +4%
MYSQL Baseline 4,055 - 3,248 +25%
MYSQL With Sentry 572 14% 358 +60%
MYSQL With Sentry (error only) 3,435 85% 2,590 +33%

View base workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow customization of level mapping in createSentryWinstonTransport

2 participants