Skip to content

Unable to setup custom OpenTelemetry with @sentry/bun. Docs are lacking info #16969

@markwitt1

Description

@markwitt1

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/bun

SDK Version

9.38.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

const sentryClient = Sentry.init({
	// enabled: process.env.NODE_ENV === "production",
	dsn: SENTRY_DSN,
	environment: process.env.ENVIRONMENT,
	integrations: [],
	tracesSampleRate: 1.0,
	// @ts-expect-error
	skipOpenTelemetrySetup: true,
});
if (!Sentry.isEnabled()) console.warn("Sentry is not enabled");

const provider = new NodeTracerProvider({
	sampler: sentryClient ? new SentrySampler(sentryClient) : undefined,
	spanProcessors: [new SentrySpanProcessor()],
});

provider.addSpanProcessor(new SentrySpanProcessor());

provider.register({
	// Ensure trace propagation works
	// This relies on the SentrySampler for correct propagation
	propagator: new SentryPropagator(),
	// Ensure context & request isolation are correctly managed
	contextManager: new Sentry.SentryContextManager(),
});
// Validate that the setup is correct
Sentry.validateOpenTelemetrySetup();

Steps to Reproduce

I tried to follow the documentations https://docs.sentry.io/platforms/javascript/guides/express/opentelemetry/custom-setup/ and https://docs.sentry.io/platforms/javascript/guides/bun/migration/v7-to-v8/v8-opentelemetry/ but especially the one for bun is lacking info, like where to get the imports from. Also skipOpenTelemetrySetup doesn't exist in the bun sdk

Expected Result

I am trying to do custom OpenTelemetry setup so that I can enable Sentry for error tracking but use langfuse for LLM tracing

Actual Result

Type errors

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions