Skip to content

feat(opentelemetry): Add addOpenTelemetryInstrumentation #11667

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

Merged
merged 1 commit into from
Apr 18, 2024

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 mydea and a team 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
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
79 checks passed
@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