Socket
Socket
Sign inDemoInstall

@sentry/node

Package Overview
Dependencies
Maintainers
11
Versions
517
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/node - npm Package Compare versions

Comparing version 8.0.0-alpha.1 to 8.0.0-alpha.2

3

cjs/integrations/anr/index.js

@@ -10,2 +10,3 @@ var {

const utils = require('@sentry/utils');
const inspector = require('inspector');
const worker_threads = require('worker_threads');

@@ -93,4 +94,2 @@ const nodeVersion = require('../../nodeVersion.js');

if (options.captureStackTrace) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const inspector = require('inspector');
if (!inspector.url()) {

@@ -97,0 +96,0 @@ inspector.open(0);

@@ -9,2 +9,3 @@ var {

const utils = require('@sentry/utils');
const inspector = require('inspector');
const nodeVersion = require('../../nodeVersion.js');

@@ -62,19 +63,3 @@ const common = require('./common.js');

constructor() {
/*
TODO: We really should get rid of this require statement below for a couple of reasons:
1. It makes the integration unusable in the SvelteKit SDK, as it's not possible to use `require`
in SvelteKit server code (at least not by default).
2. Throwing in a constructor is bad practice
More context for a future attempt to fix this:
We already tried replacing it with import but didn't get it to work because of async problems.
We still called import in the constructor but assigned to a promise which we "awaited" in
`configureAndConnect`. However, this broke the Node integration tests as no local variables
were reported any more. We probably missed a place where we need to await the promise, too.
*/
// Node can be built without inspector support so this can throw
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { Session } = require('inspector');
this._session = new Session();
this._session = new inspector.Session();
}

@@ -81,0 +66,0 @@

@@ -64,3 +64,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

if (rootSpan) {
rootSpan.setStatus('internal_error');
rootSpan.setStatus({ code: core.SPAN_STATUS_ERROR, message: 'internal_error' });
rootSpan.end();

@@ -67,0 +67,0 @@ }

@@ -101,6 +101,34 @@ Object.defineProperty(exports, '__esModule', { value: true });

// Always init Otel, even if tracing is disabled, because we need it for trace propagation & the HTTP integration
initOtel.initOtel();
// If users opt-out of this, they _have_ to set up OpenTelemetry themselves
// There is no way to use this SDK without OpenTelemetry!
if (!options.skipOpenTelemetrySetup) {
initOtel.initOtel();
}
validateOpenTelemetrySetup();
}
function validateOpenTelemetrySetup() {
if (!debugBuild.DEBUG_BUILD) {
return;
}
const setup = opentelemetry.openTelemetrySetupCheck();
const required = ['SentrySpanProcessor', 'SentryContextManager', 'SentryPropagator'] ;
for (const k of required) {
if (!setup.includes(k)) {
utils.logger.error(
`You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,
);
}
}
if (!setup.includes('SentrySampler')) {
utils.logger.warn(
'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected.',
);
}
}
function getClientOptions(options) {

@@ -107,0 +135,0 @@ if (options.defaultIntegrations === undefined) {

import { _optionalChain, _optionalChainDelete } from '@sentry/utils';
import { defineIntegration, getCurrentScope } from '@sentry/core';
import { logger } from '@sentry/utils';
import * as inspector from 'inspector';
import { Worker } from 'worker_threads';

@@ -86,4 +87,2 @@ import { NODE_MAJOR, NODE_VERSION } from '../../nodeVersion.js';

if (options.captureStackTrace) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const inspector = require('inspector');
if (!inspector.url()) {

@@ -90,0 +89,0 @@ inspector.open(0);

import { _optionalChain } from '@sentry/utils';
import { defineIntegration, convertIntegrationFnToClass, getClient } from '@sentry/core';
import { LRUMap, logger } from '@sentry/utils';
import { Session } from 'inspector';
import { NODE_MAJOR } from '../../nodeVersion.js';

@@ -56,18 +57,2 @@ import { createRateLimiter, hashFromStack, hashFrames, functionNamesMatch } from './common.js';

constructor() {
/*
TODO: We really should get rid of this require statement below for a couple of reasons:
1. It makes the integration unusable in the SvelteKit SDK, as it's not possible to use `require`
in SvelteKit server code (at least not by default).
2. Throwing in a constructor is bad practice
More context for a future attempt to fix this:
We already tried replacing it with import but didn't get it to work because of async problems.
We still called import in the constructor but assigned to a promise which we "awaited" in
`configureAndConnect`. However, this broke the Node integration tests as no local variables
were reported any more. We probably missed a place where we need to await the promise, too.
*/
// Node can be built without inspector support so this can throw
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { Session } = require('inspector');
this._session = new Session();

@@ -74,0 +59,0 @@ }

import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { HapiInstrumentation } from '@opentelemetry/instrumentation-hapi';
import { defineIntegration, SDK_VERSION, getActiveSpan, getRootSpan, captureException } from '@sentry/core';
import { defineIntegration, SDK_VERSION, getActiveSpan, getRootSpan, SPAN_STATUS_ERROR, captureException } from '@sentry/core';

@@ -62,3 +62,3 @@ const _hapiIntegration = (() => {

if (rootSpan) {
rootSpan.setStatus('internal_error');
rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });
rootSpan.end();

@@ -65,0 +65,0 @@ }

import { inboundFiltersIntegration, functionToStringIntegration, linkedErrorsIntegration, requestDataIntegration, hasTracingEnabled, getCurrentScope, getIntegrationsToSetup, getClient, startSession, getIsolationScope, endSession } from '@sentry/core';
import { setOpenTelemetryContextAsyncContextStrategy } from '@sentry/opentelemetry';
import { setOpenTelemetryContextAsyncContextStrategy, openTelemetrySetupCheck } from '@sentry/opentelemetry';
import { logger, consoleSandbox, dropUndefinedKeys, stackParserFromStackParserOptions, propagationContextFromHeaders } from '@sentry/utils';

@@ -99,6 +99,34 @@ import { DEBUG_BUILD } from '../debug-build.js';

// Always init Otel, even if tracing is disabled, because we need it for trace propagation & the HTTP integration
initOtel();
// If users opt-out of this, they _have_ to set up OpenTelemetry themselves
// There is no way to use this SDK without OpenTelemetry!
if (!options.skipOpenTelemetrySetup) {
initOtel();
}
validateOpenTelemetrySetup();
}
function validateOpenTelemetrySetup() {
if (!DEBUG_BUILD) {
return;
}
const setup = openTelemetrySetupCheck();
const required = ['SentrySpanProcessor', 'SentryContextManager', 'SentryPropagator'] ;
for (const k of required) {
if (!setup.includes(k)) {
logger.error(
`You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,
);
}
}
if (!setup.includes('SentrySampler')) {
logger.warn(
'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected.',
);
}
}
function getClientOptions(options) {

@@ -105,0 +133,0 @@ if (options.defaultIntegrations === undefined) {

{
"name": "@sentry/node",
"version": "8.0.0-alpha.1",
"version": "8.0.0-alpha.2",
"description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",

@@ -52,6 +52,6 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"@prisma/instrumentation": "5.9.0",
"@sentry/core": "8.0.0-alpha.1",
"@sentry/opentelemetry": "8.0.0-alpha.1",
"@sentry/types": "8.0.0-alpha.1",
"@sentry/utils": "8.0.0-alpha.1",
"@sentry/core": "8.0.0-alpha.2",
"@sentry/opentelemetry": "8.0.0-alpha.2",
"@sentry/types": "8.0.0-alpha.2",
"@sentry/utils": "8.0.0-alpha.2",
"@types/node": "14.18.63"

@@ -58,0 +58,0 @@ },

@@ -0,1 +1,2 @@

/// <reference types="node" />
import { StackFrame, StackParser } from '@sentry/types';

@@ -2,0 +3,0 @@ import { Debugger } from 'inspector';

@@ -0,1 +1,2 @@

/// <reference types="node" />
import { Event, Integration, IntegrationClass } from '@sentry/types';

@@ -2,0 +3,0 @@ import { Debugger, InspectorNotification } from 'inspector';

@@ -59,2 +59,11 @@ import { Span as WriteableSpan } from '@opentelemetry/api';

spotlight?: boolean | string;
/**
* If this is set to true, the SDK will not set up OpenTelemetry automatically.
* In this case, you _have_ to ensure to set it up correctly yourself, including:
* * The `SentrySpanProcessor`
* * The `SentryPropagator`
* * The `SentryContextManager`
* * The `SentrySampler`
*/
skipOpenTelemetrySetup?: boolean;
/** Callback that is executed when a fatal global error occurs. */

@@ -61,0 +70,0 @@ onFatalError?(this: void, error: Error): void;

@@ -0,1 +1,2 @@

/// <reference types="node" />
import type { StackFrame, StackParser } from '@sentry/types';

@@ -2,0 +3,0 @@ import type { Debugger } from 'inspector';

@@ -0,1 +1,2 @@

/// <reference types="node" />
import type { Event, Integration, IntegrationClass } from '@sentry/types';

@@ -2,0 +3,0 @@ import type { Debugger, InspectorNotification } from 'inspector';

@@ -59,2 +59,11 @@ import type { Span as WriteableSpan } from '@opentelemetry/api';

spotlight?: boolean | string;
/**
* If this is set to true, the SDK will not set up OpenTelemetry automatically.
* In this case, you _have_ to ensure to set it up correctly yourself, including:
* * The `SentrySpanProcessor`
* * The `SentryPropagator`
* * The `SentryContextManager`
* * The `SentrySampler`
*/
skipOpenTelemetrySetup?: boolean;
/** Callback that is executed when a fatal global error occurs. */

@@ -61,0 +70,0 @@ onFatalError?(this: void, error: Error): void;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc