self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

Profiling doesn't work on self-hosted instance (404)

Open abriginets opened this issue 5 months ago • 1 comments

Self-Hosted Version

25.3.0

CPU Architecture

ARM64 (Ampere Altra on Hetzner)

Docker Version

Docker version 27.1.1, build 6312585

Docker Compose Version

Docker Compose version v2.35.0

Machine Specification

  • [x] My system meets the minimum system requirements of Sentry

Steps to Reproduce

I'm using NestJS integration + node profiling according to the official documentation.

import * as Sentry from '@sentry/nestjs';
import { nodeProfilingIntegration } from '@sentry/profiling-node';
import dotenv from 'dotenv';

dotenv.config();

if (!process.env.SENTRY_DSN) {
  throw new Error('process.env.SENTRY_DSN is not defined');
}

if (!process.env.SENTRY_ENV) {
  throw new Error('process.env.SENTRY_ENV is not defined');
}

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  sampleRate: 0.1,
  environment: process.env.SENTRY_ENV,
  tracesSampler: (context) => {
    if (context.name.includes('/api/search')) {
      return 1.0;
    }

    return context.inheritOrSampleWith(0.01);
  },
  integrations: [Sentry.prismaIntegration(), nodeProfilingIntegration()],
  profileSessionSampleRate: 1.0,
  profileLifecycle: 'trace',
});

I have verified that trace with profiling id is indeed uploaded to Sentry by enabling debug mode. Here are my logs:

Log
Sentry Logger [log]: [Tracing] Discarding transaction because it's not included in the random sample (sampling rate = 0.01)
Sentry Logger [log]: [Tracing] Discarding root span because its trace was not chosen to be sampled.
Sentry Logger [log]: Recording outcome: "sample_rate:transaction"
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for info: false
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
[flaut-nestjs] 56653 6/18/2025, 4:06:57 AM     LOG [NestApplication] Nest application successfully started - { service: 'flaut-nestjs' } +19ms
Sentry Logger [log]: [Tracing] Discarding transaction because it's not included in the random sample (sampling rate = 0.01)
Sentry Logger [log]: [Tracing] Discarding root span because its trace was not chosen to be sampled.
Sentry Logger [log]: Recording outcome: "sample_rate:transaction"
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for prisma:client:serialize: false
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [log]: @sentry/instrumentation-http Patching server.emit
Sentry Logger [log]: @sentry/instrumentation-http Handling incoming request
Sentry Logger [log]: @sentry/instrumentation-http Patching request.on
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http http instrumentation incomingRequest
Sentry Logger [log]: [Tracing] Inheriting remote parent's sampled decision for POST: false
Sentry Logger [log]: [Tracing] Starting sampled root span
  op: < unknown op >
  name: POST
  ID: 305b929fa83f9774
  parent ID: 2922048ccf051213
Sentry Logger [log]: [Profiling] starting profiling chunk: 1d703f1faf274e7187c27960946fcc52
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for middleware - jsonParser: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: middleware - jsonParser
  ID: ef93f805cc9e94cc
  parent ID: 305b929fa83f9774
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: @sentry/instrumentation-http Handling request.on("data") with maximum body size of 10000b
Sentry Logger [log]: [Tracing] Finishing "middleware.express" span "jsonParser" with ID ef93f805cc9e94cc
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for middleware - urlencodedParser: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: middleware - urlencodedParser
  ID: ece5f1c203de4d14
  parent ID: 305b929fa83f9774
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "middleware.express" span "urlencodedParser" with ID ece5f1c203de4d14
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for request handler - /api/{*splat}: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: request handler - /api/{*splat}
  ID: 27894f91c25bb9cc
  parent ID: 305b929fa83f9774
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "request_handler.express" span "/api/{*splat}" with ID 27894f91c25bb9cc
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for UserIpMiddleware: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: UserIpMiddleware
  ID: 76e0ff263e56bb15
  parent ID: 305b929fa83f9774
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "UserIpMiddleware" with ID 76e0ff263e56bb15
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for request handler - /api/search/v1/results/:searchUuid: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: request handler - /api/search/v1/results/:searchUuid
  ID: a90d6e9ff82c6120
  parent ID: 305b929fa83f9774
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "request_handler.express" span "/api/search/v1/results/:searchUuid" with ID a90d6e9ff82c6120
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for SearchController.getSearchResults: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: SearchController.getSearchResults
  ID: a289bbe7f9633547
  parent ID: 305b929fa83f9774
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for SentryTracingInterceptor: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: SentryTracingInterceptor
  ID: 7f5acc368f57edc4
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "SentryTracingInterceptor" with ID 7f5acc368f57edc4
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for Interceptors - After Route: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: Interceptors - After Route
  ID: b6f0e07e55f0ef29
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for SentryTracingInterceptor: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: SentryTracingInterceptor
  ID: 6122695d70b81117
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "SentryTracingInterceptor" with ID 6122695d70b81117
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for UnsubscribeOnCloseInterceptor: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: UnsubscribeOnCloseInterceptor
  ID: 48bfe92e8038783c
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "UnsubscribeOnCloseInterceptor" with ID 48bfe92e8038783c
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for ValidationPipe: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: ValidationPipe
  ID: 4a8f845307cbe32f
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for ValidationPipe: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: ValidationPipe
  ID: eb072b46f5c728a2
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "ValidationPipe" with ID eb072b46f5c728a2
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "ValidationPipe" with ID 4a8f845307cbe32f
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for ParseUUIDPipe: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: middleware.nestjs
  name: ParseUUIDPipe
  ID: b9b48e918f646a64
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "ParseUUIDPipe" with ID b9b48e918f646a64
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for getSearchResults: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: getSearchResults
  ID: 884815f9b9434d95
  parent ID: a289bbe7f9633547
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for get: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: get
  ID: 5f6d554fa383997a
  parent ID: 884815f9b9434d95
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [log]: [Tracing] Finishing "< unknown op >" span "get" with ID 5f6d554fa383997a
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for POST: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: POST
  ID: e6b77c34311ce2e8
  parent ID: 884815f9b9434d95
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http https instrumentation outgoingRequest
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http http.ClientRequest return request
Sentry Logger [log]: @sentry/instrumentation-http Handling finished outgoing request
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on response()
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on end()
Sentry Logger [log]: [Tracing] Finishing "< unknown op >" span "POST" with ID e6b77c34311ce2e8
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on request close()
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for GET: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: GET
  ID: 157fb05e2092a7e0
  parent ID: 884815f9b9434d95
  root ID: 305b929fa83f9774
  root description: POST
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http https instrumentation outgoingRequest
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http http.ClientRequest return request
Sentry Logger [log]: @sentry/instrumentation-http Handling finished outgoing request
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on response()
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on end()
Sentry Logger [log]: [Tracing] Finishing "< unknown op >" span "GET" with ID 157fb05e2092a7e0
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on request close()
Sentry Logger [log]: [Tracing] Finishing "handler.nestjs" span "getSearchResults" with ID 884815f9b9434d95
Sentry Logger [log]: [Tracing] Finishing "middleware.nestjs" span "Interceptors - After Route" with ID b6f0e07e55f0ef29
Sentry Logger [log]: [Tracing] Finishing "request_context.nestjs" span "SearchController.getSearchResults" with ID a289bbe7f9633547
Sentry Logger [debug]: Recorded request session with status: ok
Sentry Logger [debug]: Opened new request session aggregate.
Sentry Logger [log]: [Tracing] Finishing "< unknown op >" root span "POST /api/search/v1/results/:searchUuid" with ID 305b929fa83f9774
Sentry Logger [log]: [Profiling] Stopping profiling chunk: 1d703f1faf274e7187c27960946fcc52
Sentry Logger [log]: [Profiling] Sending profile chunk 1d703f1faf274e7187c27960946fcc52.
Sentry Logger [log]: [Profiling] Profile chunk 1d703f1faf274e7187c27960946fcc52 sent to Sentry.
Sentry Logger [debug]: Instrumentation suppressed, returning Noop Span
Sentry Logger [log]: [Tracing] Not injecting trace data for url because tracing is suppressed.
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http https instrumentation outgoingRequest
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http http.ClientRequest return request
Sentry Logger [log]: SpanExporter exported 18 spans, 0 spans are waiting for their parent spans to finish
Sentry Logger [debug]: Instrumentation suppressed, returning Noop Span
Sentry Logger [log]: [Tracing] Not injecting trace data for url because tracing is suppressed.
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http https instrumentation outgoingRequest
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http http.ClientRequest return request
Sentry Logger [log]: @sentry/instrumentation-http Handling finished outgoing request
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on response()
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on end()
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on request close()
Sentry Logger [log]: @sentry/instrumentation-http Handling finished outgoing request
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on response()
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on end()
Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on request close()

The part where it says

Sentry Logger [log]: [Profiling] Stopping profiling chunk: 1d703f1faf274e7187c27960946fcc52
Sentry Logger [log]: [Profiling] Sending profile chunk 1d703f1faf274e7187c27960946fcc52.
Sentry Logger [log]: [Profiling] Profile chunk 1d703f1faf274e7187c27960946fcc52 sent to Sentry.

Expected Result

Profiles should be visible in Sentry admin.

Actual Result

But I don't see any profiles neither in Profiles tab, nor in Stats -> Profiles sections.

Image

When I'm looking at the event on Discover tab, there is a profile ID

Image

But when I'm clicking on it, it says "Failed to fetch profiles"

In network tab the following requests are failing with 404 Not Found.

https://sentry.flaut.travel/api/0/projects/flaut/flaut-nestjs-7z/events/4365e114b8a641ce88905fae604a0700/committers/
https://sentry.flaut.travel/api/0/organizations/flaut/profiling/chunks/?end=2025-06-18T14%3A41%3A12.735Z&profiler_id=0c33a7bed39a4583b9111e328675f79a&project=4&start=2025-06-18T14%3A41%3A11.590Z

Event ID

No response

abriginets avatar Jun 18 '25 14:06 abriginets