#Astro - Enable Profiling

8 messages · Page 1 of 1 (latest)

pure wraith
#

I'm attempting to enable profiling in an Astro project. The SDK is correctly configured to send errors. The integration is configured with

sentry({
  dsn: "...",
  environment: 'production',
  tracesSampleRate: 1,
  replaysSessionSampleRate: 1,
  replaysOnErrorSampleRate: 1,
  sourceMapsUploadOptions: {
    project: "...",
    authToken: process.env.SENTRY_AUTH_TOKEN,
  },
  enabled: true,
}),

The sentry.server.config.js file looks like

Sentry.init({
  dsn: '...',
  environment: "production",
  integrations: [nodeProfilingIntegration()],

  tracesSampleRate: 1,
  profilesSampleRate: 1,
  profileSessionSampleRate: 1,
  profileLifecycle: "trace",
  enabled: true,
})

The file is at least being loaded, but nothing shows in profiling in the dashboard.

Running Node 22.14, latest version of the Astro SDK & profiling package, on MacOS.

I only found one discussion https://github.com/getsentry/sentry-javascript/discussions/13514 about setting this up with no response

#

Tried posting this in the SDK channel recommended at the top of this channel, but it failed to post there

opal lynx
#

these options are for two different profiling modes:

  profilesSampleRate: 1,
  profileSessionSampleRate: 1,
  profileLifecycle: "trace",
#

can you try either:

  profilesSampleRate: 1,

or

  profileSessionSampleRate: 1,
  profileLifecycle: "trace",

and adding debug:true to see the SDK logs in the app console, this will help you understand why profiles are not sent

pure wraith
#
......
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [log]: SpanExporter exported 0 spans, 0 spans are waiting for their parent spans to finish
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send
Sentry Logger [debug]: Sending request session aggregate due to client flush
Sentry Logger [warn]: Discarded session because of missing or non-string release
10:07:21 [200] /manage/otterwilds/players 68ms
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [debug]: Opened new request session aggregate.
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [log]: SpanExporter exported 0 spans, 0 spans are waiting for their parent spans to finish
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send
Sentry Logger [debug]: Sending request session aggregate due to client flush
Sentry Logger [warn]: Discarded session because of missing or non-string release
10:07:21 [200] /manage/otterwilds/players 42ms
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [debug]: Opened new request session aggregate.
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
......
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [log]: Flushing client reports based on interval.
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send
Sentry Logger [log]: Flushing client reports based on interval.
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send
Sentry Logger [log]: Flushing client reports based on interval.
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send
Sentry Logger [debug]: Sending request session aggregate due to flushing schedule
Sentry Logger [log]: @sentry/instrumentation-http Handling finished outgoing request
Sentry Logger [log]: Flushing client reports based on interval.
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send
Sentry Logger [debug]: Sending request session aggregate due to flushing schedule
Sentry Logger [warn]: Discarded session because of missing or non-string release

truncated, this is what I see with profilesSampleRate. looks to be the same with the other options

opal lynx
#

do you see Sentry Logger [log]: Integration installed: ProfilingIntegration when the app starts?

pure wraith
#

yep

Sentry Logger [log]: Initializing Sentry: process: 9289, thread: main.
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: NodeFetch
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: LocalVariablesAsync
Sentry Logger [log]: Integration installed: Context
Sentry Logger [log]: Integration installed: ChildProcess
Sentry Logger [log]: Integration installed: ProcessSession
Sentry Logger [log]: Integration installed: Modules
Sentry Logger [log]: Integration installed: ProfilingIntegration
Sentry Logger [log]: Running in ESM mode.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for trace v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for propagation v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for context v1.9.0.
Sentry Logger [debug]: @sentry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Sentry Logger [debug]: @sentry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https' }
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
opal lynx
#

i was trying to reproduce the issue on my side, but not being an astro developer I failed to create a task that generates enough samples for a profile to be build and sent.
the line with the integration initialising should make the SDK send profiles, or at least log lines starting with [profiling]