Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Oct 14, 2025

This PR adds two methods to the pinoIntegration export. trackLogger and untrackLogger;

untrackLogger can be used to disable capturing from a specific logger.

You can also disable autoInstrument and only track specific loggers:

import * as Sentry from '@sentry/node';
import pino from 'pino';

Sentry.init({
  dsn: '__DSN__',
  integrations: [Sentry.pinoIntegration({ autoInstrument: false })],
});

const logger = pino({});
Sentry.pinoIntegration.trackLogger(logger);

logger.debug('This will be captured!');

@timfish timfish requested a review from AbhiPrasad October 14, 2025 18:49
@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.64 kB - -
@sentry/browser - with treeshaking flags 23.14 kB - -
@sentry/browser (incl. Tracing) 40.85 kB - -
@sentry/browser (incl. Tracing, Replay) 79.21 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 68.92 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 83.91 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 96.08 kB - -
@sentry/browser (incl. Feedback) 41.33 kB - -
@sentry/browser (incl. sendFeedback) 29.3 kB - -
@sentry/browser (incl. FeedbackAsync) 34.26 kB - -
@sentry/react 26.35 kB - -
@sentry/react (incl. Tracing) 42.84 kB - -
@sentry/vue 29.13 kB - -
@sentry/vue (incl. Tracing) 42.64 kB - -
@sentry/svelte 24.66 kB - -
CDN Bundle 26.94 kB - -
CDN Bundle (incl. Tracing) 41.53 kB - -
CDN Bundle (incl. Tracing, Replay) 77.8 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 83.28 kB - -
CDN Bundle - uncompressed 78.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 123.07 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 238.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 251 kB - -
@sentry/nextjs (client) 44.9 kB - -
@sentry/sveltekit (client) 41.27 kB - -
@sentry/node-core 50.78 kB - -
@sentry/node 154.4 kB - -
@sentry/node - without tracing 92.65 kB - -
@sentry/aws-serverless 106.35 kB -0.01% -2 B 🔽

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2025

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.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,336 - 9,104 -8%
GET With Sentry 1,272 15% 1,402 -9%
GET With Sentry (error only) 6,000 72% 6,155 -3%
POST Baseline 1,172 - 1,221 -4%
POST With Sentry 484 41% 518 -7%
POST With Sentry (error only) 1,025 87% 1,061 -3%
MYSQL Baseline 3,157 - 3,356 -6%
MYSQL With Sentry 483 15% 527 -8%
MYSQL With Sentry (error only) 2,591 82% 2,757 -6%

View base workflow run

AbhiPrasad
AbhiPrasad previously approved these changes Oct 14, 2025
@AbhiPrasad
Copy link
Member

Can we add a test for child loggers as well here?

@timfish
Copy link
Collaborator Author

timfish commented Oct 14, 2025

Can we add a test for child loggers as well here?

Looks like that test will fail. I'll fix that and include the additional test in another PR.

@AbhiPrasad AbhiPrasad dismissed their stale review October 14, 2025 21:31

child logger test first

@timfish timfish marked this pull request as draft October 14, 2025 23:06
@timfish timfish marked this pull request as ready for review October 15, 2025 09:49
cursor[bot]

This comment was marked as outdated.

@AbhiPrasad AbhiPrasad merged commit 480217f into develop Oct 15, 2025
138 checks passed
@AbhiPrasad AbhiPrasad deleted the timfish/feat/pino-manual-instrumentation branch October 15, 2025 13:56
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.

Pino integration wraps all loggers (sometimes undesired)

2 participants