Skip to content

Profiles not sent by express SDK #14655

Closed
@rodolfoBee

Description

@rodolfoBee

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

8.42.0

Framework Version

express v4.18.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

instrument.js

const Sentry = require("@sentry/node");
const { nodeProfilingIntegration } = require("@sentry/profiling-node");

// Ensure to call this before requiring any other modules!
Sentry.init({
  debug:true,
  dsn: "....",
  integrations: [
    // Add our Profiling integration
    nodeProfilingIntegration(),
  ],
  // Add Tracing by setting tracesSampleRate
  // We recommend adjusting this value in production
  tracesSampleRate: 1.0,

  // Set sampling rate for profiling
  // This is relative to tracesSampleRate
  profilesSampleRate: 1.0,
});

app code:

require("./instrument");

// Now require other modules
const express = require("express");
const Sentry = require("@sentry/node");

const app = express()
const port = 8000
const http = require('http')

function bubble (arr){ //bubble sort for computation
  for (var i = 0; i < arr.length; i++) {
      for (var j = 0; j < (arr.length - i - 1); j++) {
          if (arr[j] > arr[j + 1]) {
              var temp = arr[j]
              arr[j] = arr[j + 1]
              arr[j + 1] = temp
          }
      }
  }
}

app.get("/", function rootHandler(req, res) {
  var arr = Array.from({length: 400000}, () => Math.floor(Math.random() * 4000));
  bubble(arr)
  res.end("hiii")
});

Sentry.setupExpressErrorHandler(app);
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))

Steps to Reproduce

  1. Run the app above
  2. Go to localhost:8000

Expected Result

The SDK sends profiles and transactions to the Sentry project.

Actual Result

Transactions are sent but no profiles. Here is the SDK debug log attached. Noticeably are the lines:

Sentry Logger [log]: [Profiling] started profiling transaction: GET
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for middleware - query: true
Sentry Logger [log]: [Tracing] Starting sampled span
....
Sentry Logger [log]: [Profiling] stopped profiling of transaction: GET /
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send
Sentry Logger [log]: [Profiling] max profile duration elapsed, stopping profiling for: GET /
Sentry Logger [log]: [Profiling] stopped profiling of transaction: GET /
Sentry Logger [log]: [Profiling] profiler returned null profile for: GET / this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started
Sentry Logger [log]: Flushing client reports based on interval.

These are the same log messages reported by the affected customer, which had profiles sent by the SDK normally prior to the update from v7.120.0 to v8.42.0

profilelogs.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nodeIssues related to the Sentry Node SDKPackage: profiling-nodeIssues related to the Sentry Profiling Node SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions