Skip to content

Conversation

@AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Apr 18, 2024

Adds addOpenTelemetryInstrumentation, a helper that can be used to dynamically register OpenTelemetry instrumentation. This helps unblock work on #11548

The helper itself is quite small:

export function addOpenTelemetryInstrumentation(
  instrumentation: InstrumentationOption | InstrumentationOption[],
): void {
  registerInstrumentations({
    instrumentations: Array.isArray(instrumentation) ? instrumentation : [instrumentation],
  });
}

and is designed to accept either a standalone instrumentation or an array of instrumentations. This gives users a ton of flexibility into usage!

@AbhiPrasad AbhiPrasad requested review from a team and mydea April 18, 2024 01:17
@AbhiPrasad AbhiPrasad self-assigned this Apr 18, 2024
@AbhiPrasad AbhiPrasad requested review from stephanie-anderson and removed request for a team April 18, 2024 01:17
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser 21.67 KB (0%)
@sentry/browser (incl. Tracing) 31.46 KB (0%)
@sentry/browser (incl. Tracing, Replay) 66.79 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 60.19 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 70.62 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 80.5 KB (0%)
@sentry/browser (incl. Feedback) 35.25 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal) 35.25 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal, Feedback Screenshot) 37.28 KB (0%)
@sentry/browser (incl. sendFeedback) 26.46 KB (0%)
@sentry/react 24.35 KB (0%)
@sentry/react (incl. Tracing) 34.37 KB (0%)
@sentry/vue 25.2 KB (0%)
@sentry/vue (incl. Tracing) 33.18 KB (0%)
@sentry/svelte 21.79 KB (0%)
CDN Bundle 24.03 KB (0%)
CDN Bundle (incl. Tracing) 32.76 KB (0%)
CDN Bundle (incl. Tracing, Replay) 66.4 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 82.6 KB (0%)
CDN Bundle - uncompressed 70.86 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 97.59 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 207.25 KB (0%)
@sentry/nextjs (client) 33.7 KB (0%)
@sentry/sveltekit (client) 31.96 KB (0%)
@sentry/node 156.04 KB (+0.12% 🔺)

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice!

@AbhiPrasad AbhiPrasad merged commit 97b077a into develop Apr 18, 2024
@AbhiPrasad AbhiPrasad deleted the abhi-addOpenTelemetryInstrumentation branch April 18, 2024 13:08
@timfish
Copy link
Collaborator

timfish commented Apr 19, 2024

Oooh just noticed this, a very nice addition which lessens the need for touching otel directly.

Whenever I see InstrumentationOption | InstrumentationOption[] it makes me think rest parameters would be simpler:

export function addOpenTelemetryInstrumentations(...instrumentations: InstrumentationOption[]): void {

@AbhiPrasad
Copy link
Member Author

Whenever I see InstrumentationOption | InstrumentationOption[] it makes me think rest parameters would be simpler:

Actually good call on that API! I might make the quick breaking change for it.

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.

3 participants