Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry doesn't emit any instrumentation events when using Fastify adapter #14400

Open
3 tasks done
LuisCarrilloR opened this issue Nov 21, 2024 · 4 comments
Open
3 tasks done
Labels
Package: nestjs Issues related to the Sentry Nestjs SDK Waiting for: Community

Comments

@LuisCarrilloR
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nestjs

SDK Version

8.39.0

Framework Version

NestJS 10.3.10

Link to Sentry event

No response

Reproduction Example/SDK Setup

Having the following configuration, the app continously logs Isolation scope is still the default isolation scope, skipping setting transactionName.

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

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.NODE_ENV,
  integrations: [nodeProfilingIntegration()],
  debug: true,
  release: process.env.NODE_ENV,
  enabled: process.env.API_TRACING_ENABLED === 'true',
  tracesSampler: (samplingContext) => {
    if (samplingContext?.transactionContext?.name === 'GET /') {
      return 0;
    }
    return 0.1;
  },
  profilesSampleRate: 1.0,
});
// main.ts
import * as dotenv from 'dotenv';
dotenv.config();

import '@shared/config/modules/sentry/instrument'; // Sentry import
import { NestFactory, Reflector } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';

async function bootstrap() {
  const adapter = new FastifyAdapter();
  
// some adapter configs here

  const app = await NestFactory.create<NestFastifyApplication>(AppModule, adapter);


  await app.listen(process.env.PORT ? parseInt(process.env.PORT) : 80, '0.0.0.0');
  console.log('Server runing in port', process.env.PORT || 'default (80)');
}
bootstrap();

Steps to Reproduce

  1. Setup Client.
  2. Init application.
2024-11-21T00:03:16.243-06:00 | > node dist/main.js
-- | --
  | 2024-11-21T00:03:20.015-06:00 | Sentry Logger [log]: Initializing Sentry: process: 18, thread: main.
  | 2024-11-21T00:03:20.018-06:00 | Sentry Logger [log]: Running in CommonJS mode.
  | 2024-11-21T00:03:20.022-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.9.0.
  | 2024-11-21T00:03:20.025-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for trace v1.9.0.
  | 2024-11-21T00:03:20.025-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for context v1.9.0.
  | 2024-11-21T00:03:20.026-06:00 | Sentry Logger [debug]: @opentelemetry/api: Registered a global for propagation v1.9.0.
  | 2024-11-21T00:03:34.513-06:00 | �[32m[Nest] 18 - �[39m11/21/2024, 6:03:34 AM �[32m LOG�[39m �[38;5;3m[NestFactory] �[39m�[32mStarting Nest application...�[39m
  | 2024-11-21T00:03:35.803-06:00 | �[32m[Nest] 18 - �[39m11/21/2024, 6:03:35 AM �[32m LOG�[39m �[38;5;3m[InstanceLoader] �[39m�[32mSentryModule dependencies initialized�[39m�[38;5;3m +1293ms�[39m


  1. No transactions are detected.
  2. Logs continuously show
Sentry Logger [warn]: Isolation scope is still the default isolation scope, skipping setting transactionName.
Sentry Logger [warn]: Isolation scope is still the default isolation scope, skipping setting transactionName.
Sentry Logger [warn]: Isolation scope is still the default isolation scope, skipping setting transactionName.
Sentry Logger [log]: Flushing client reports based on interval.
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: No outcomes to send

Expected Result

I expect to see at least some transactions in Sentry but nothing is being sent.

Actual Result

Events are not being detected while using the app

Image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 21, 2024
@github-actions github-actions bot added the Package: nestjs Issues related to the Sentry Nestjs SDK label Nov 21, 2024
@andreiborza
Copy link
Member

Hey @LuisCarrilloR, thanks for filing this.

Could you please provide a reproduction repo or stackblitz so we can try this?

@mydea
Copy link
Member

mydea commented Dec 2, 2024

@chargome could we possibly add an E2E test app for this, to check if this generally works?

@chargome
Copy link
Member

chargome commented Dec 2, 2024

@mydea yes, got this on my list 👍

@LuisCarrilloR
Copy link
Author

@andreiborza, it seems to be addressed here: #14549. Going to check later and close the issue if it works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nestjs Issues related to the Sentry Nestjs SDK Waiting for: Community
Projects
Status: Waiting for: Community
Development

No branches or pull requests

4 participants