Skip to content

feat(opentelemetry): Add addOpenTelemetryInstrumentation - #11667

Merged
AbhiPrasad merged 1 commit into
developfrom
abhi-addOpenTelemetryInstrumentation
Apr 18, 2024
Merged

feat(opentelemetry): Add addOpenTelemetryInstrumentation#11667
AbhiPrasad merged 1 commit into
developfrom
abhi-addOpenTelemetryInstrumentation

Conversation

@AbhiPrasad

@AbhiPrasadAbhiPrasad commented Apr 18, 2024

Copy link
Copy Markdown
Contributor

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:

exportfunctionaddOpenTelemetryInstrumentation(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 mydeaApril 18, 2024 01:17
@AbhiPrasadAbhiPrasad self-assigned this Apr 18, 2024
@AbhiPrasad
AbhiPrasad requested review from stephanie-anderson and removed request for a teamApril 18, 2024 01:17
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
@sentry/browser21.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 flags60.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/react24.35 KB (0%)
@sentry/react (incl. Tracing)34.37 KB (0%)
@sentry/vue25.2 KB (0%)
@sentry/vue (incl. Tracing)33.18 KB (0%)
@sentry/svelte21.79 KB (0%)
CDN Bundle24.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 - uncompressed70.86 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed97.59 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed207.25 KB (0%)
@sentry/nextjs (client)33.7 KB (0%)
@sentry/sveltekit (client)31.96 KB (0%)
@sentry/node156.04 KB (+0.12% 🔺)

@mydeamydea left a comment

Copy link
Copy Markdown
Member

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 developApr 18, 2024
@AbhiPrasad
AbhiPrasad deleted the abhi-addOpenTelemetryInstrumentation branch April 18, 2024 13:08
@timfish

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
ContributorAuthor

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 freeto 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

@AbhiPrasad@timfish@mydea