Skip to content

CustomSamplingContext is not passed to profilesSampler callback #13705

@voho

Description

@voho

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

7.119.0

Framework Version

7.119.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

Sentry.init({
    dsn: SENTRY_DSN,
    attachStacktrace: true,
    includeLocalVariables: true,
    release: VERSION,
    tracesSampler: ctx => {
        console.log("tracesSampler ctx", ctx.custom)
        return 0
    },
    profilesSampler: ctx => {
        console.log("profilesSampler ctx", ctx.custom)
        return 0
    },
    integrations: [
        new Sentry.Integrations.LocalVariables({
            captureAllExceptions: true,
        }),
        new Sentry.Integrations.ContextLines({
            frameContextLines: 12, // Default is 7
        }),
        new Sentry.Integrations.Http({
            tracing: true,
        }),
        // Enable node profiling
        nodeProfilingIntegration(),
    ],
})

Steps to Reproduce

  1. Initialize Sentry with tracesSampler and profilesSampler callbacks.
  2. Send custom context when starting transaction (startTransaction).
  3. Get custom context in the profilesSampler callback.
const transaction = Sentry.getCurrentHub().startTransaction({ name: `XXX` }, { custom: 'XXX' }) as
    | Sentry.Transaction
    | undefined

Expected Result

Custom context is passed.

Actual Result

Custom context is not passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions