@sentry/node
Advanced tools
Comparing version 8.0.0-alpha.2 to 8.0.0-alpha.3
{ | ||
"name": "@sentry/node", | ||
"version": "8.0.0-alpha.2", | ||
"version": "8.0.0-alpha.3", | ||
"description": "Sentry Node SDK using OpenTelemetry for performance instrumentation", | ||
@@ -10,3 +10,3 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"engines": { | ||
"node": ">=14.8" | ||
"node": ">=14.18" | ||
}, | ||
@@ -22,2 +22,15 @@ "files": [ | ||
"types": "types/index.d.ts", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"import": { | ||
"types": "./types/index.d.ts", | ||
"default": "./esm/index.js" | ||
}, | ||
"require": { | ||
"types": "./types/index.d.ts", | ||
"default": "./cjs/index.js" | ||
} | ||
} | ||
}, | ||
"typesVersions": { | ||
@@ -54,6 +67,8 @@ "<4.9": { | ||
"@prisma/instrumentation": "5.9.0", | ||
"@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", | ||
"@sentry/core": "8.0.0-alpha.3", | ||
"@sentry/opentelemetry": "8.0.0-alpha.3", | ||
"@sentry/types": "8.0.0-alpha.3", | ||
"@sentry/utils": "8.0.0-alpha.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "14.18.63" | ||
@@ -60,0 +75,0 @@ }, |
107
README.md
@@ -7,23 +7,15 @@ <p align="center"> | ||
# Official Sentry SDK for Node (EXPERIMENTAL) | ||
# Official Sentry SDK for Node | ||
[![npm version](https://img.shields.io/npm/v/@sentry/node-experimental.svg)](https://www.npmjs.com/package/@sentry/node-experimental) | ||
[![npm dm](https://img.shields.io/npm/dm/@sentry/node-experimental.svg)](https://www.npmjs.com/package/@sentry/node-experimental) | ||
[![npm dt](https://img.shields.io/npm/dt/@sentry/node-experimental.svg)](https://www.npmjs.com/package/@sentry/node-experimental) | ||
[![npm version](https://img.shields.io/npm/v/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) | ||
[![npm dm](https://img.shields.io/npm/dm/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) | ||
[![npm dt](https://img.shields.io/npm/dt/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) | ||
This is a WIP, proof of concept implementation of a Node SDK that uses OpenTelemetry for performance instrumentation under the hood. | ||
THIS MAY/WILL BREAK IN MANY UNEXPECTED WAYS. We may remove, add, change any of the integrations, add/remove any exports, etc. | ||
This package is **NOT READY TO USE IN ANY FORM OF PRODUCTION ENVIRONMENT**! | ||
This SDK is **considered experimental and in an alpha state**. It may experience breaking changes, and may be discontinued at any time. Please reach out on | ||
[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback/concerns. | ||
## Installation | ||
```bash | ||
npm install @sentry/node-experimental | ||
npm install @sentry/node | ||
# Or yarn | ||
yarn add @sentry/node-experimental | ||
yarn add @sentry/node | ||
``` | ||
@@ -35,5 +27,5 @@ | ||
// CJS Syntax | ||
const Sentry = require('@sentry/node-experimental'); | ||
const Sentry = require('@sentry/node'); | ||
// ESM Syntax | ||
import * as Sentry from '@sentry/node-experimental'; | ||
import * as Sentry from '@sentry/node'; | ||
@@ -48,62 +40,9 @@ Sentry.init({ | ||
## Status of this Experiment | ||
[More information on how to set up Sentry for Node in v8.](./../../docs/v8-node.md) | ||
Currently, this SDK: | ||
* Will capture errors (same as @sentry/node) | ||
* Auto-instrument for performance - see below for which performance integrations are available. | ||
* Provide _some_ manual instrumentation APIs | ||
* Sync OpenTelemetry Context with our Sentry Hub/Scope | ||
### Manual Instrumentation | ||
You can manual instrument using the following APIs: | ||
```js | ||
const Sentry = require('@sentry/node-experimental'); | ||
Sentry.startSpan({ description: 'outer' }, function (span) { | ||
span.setData(customData); | ||
doSomethingSlow(); | ||
Sentry.startSpan({ description: 'inner' }, function() { | ||
// inner span is a child of outer span | ||
doSomethingVerySlow(); | ||
// inner span is auto-ended when this callback ends | ||
}); | ||
// outer span is auto-ended when this callback ends | ||
}); | ||
``` | ||
You can also create spans without marking them as the active span. | ||
Note that for most scenarios, we recommend the `startSpan` syntax. | ||
```js | ||
const Sentry = require('@sentry/node-experimental'); | ||
// This will _not_ be put on the scope/set as active, so no other spans will be attached to it | ||
const span = Sentry.startInactiveSpan({ description: 'non-active span' }); | ||
doSomethingSlow(); | ||
span.end(); | ||
``` | ||
Finally you can also get the currently active span, if you need to do more with it: | ||
```js | ||
const Sentry = require('@sentry/node-experimental'); | ||
const span = Sentry.getActiveSpan(); | ||
``` | ||
### Async Context | ||
We leverage the OpenTelemetry context forking in order to ensure isolation of parallel requests. | ||
This means that as long as you are using an OpenTelemetry instrumentation for your framework of choice | ||
(currently: Express or Fastify), you do not need to setup any `requestHandler` or similar. | ||
### ESM Support | ||
Due to the way OpenTelemetry handles instrumentation, this only works out of the box for CommonJS (`require`) applications. | ||
Due to the way OpenTelemetry handles instrumentation, this only works out of the box for CommonJS (`require`) | ||
applications. | ||
There is experimental support for running OpenTelemetry with ESM (`"type": "module"`): | ||
@@ -117,26 +56,8 @@ | ||
See [OpenTelemetry Instrumentation Docs](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation#instrumentation-for-es-modules-in-nodejs-experimental) for details on this - | ||
but note that this is a) experimental, and b) does not work with all integrations. | ||
See | ||
[OpenTelemetry Instrumentation Docs](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation#instrumentation-for-es-modules-in-nodejs-experimental) | ||
for details on this - but note that this is a) experimental, and b) does not work with all integrations. | ||
## Available (Performance) Integrations | ||
* Http | ||
* Express | ||
* Fastify | ||
* Nest | ||
* Mysql | ||
* Mysql2 | ||
* GraphQL | ||
* Mongo | ||
* Mongoose | ||
* Postgres | ||
* Prisma | ||
All of these are auto-discovered, you don't need to configure anything for performance. | ||
You still need to register middlewares etc. for error capturing. | ||
Other, non-performance integrations from `@sentry/node` are also available (except for Undici). | ||
## Links | ||
- [Official SDK Docs](https://docs.sentry.io/quickstart/) |
@@ -12,3 +12,3 @@ export { httpIntegration } from './integrations/http'; | ||
export { expressIntegration, expressErrorHandler, setupExpressErrorHandler } from './integrations/tracing/express'; | ||
export { fastifyIntegration } from './integrations/tracing/fastify'; | ||
export { fastifyIntegration, setupFastifyErrorHandler } from './integrations/tracing/fastify'; | ||
export { graphqlIntegration } from './integrations/tracing/graphql'; | ||
@@ -23,2 +23,3 @@ export { mongoIntegration } from './integrations/tracing/mongo'; | ||
export { hapiIntegration, setupHapiErrorHandler } from './integrations/tracing/hapi'; | ||
export { spotlightIntegration } from './integrations/spotlight'; | ||
export { init, getDefaultIntegrations } from './sdk/init'; | ||
@@ -32,7 +33,7 @@ export { getAutoPerformanceIntegrations } from './integrations/tracing'; | ||
export { cron } from './cron'; | ||
export { Span, NodeOptions } from './types'; | ||
export { startSpan, startSpanManual, startInactiveSpan, getActiveSpan, withActiveSpan, } from '@sentry/opentelemetry'; | ||
export { NodeOptions } from './types'; | ||
export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData, } from '@sentry/utils'; | ||
export { addBreadcrumb, isInitialized, getGlobalScope, close, createTransport, flush, Hub, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, continueTrace, parameterize, getCurrentScope, getIsolationScope, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, } from '@sentry/core'; | ||
export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, Transaction, User, } from '@sentry/types'; | ||
export { continueTrace } from '@sentry/opentelemetry'; | ||
export { addBreadcrumb, isInitialized, getGlobalScope, close, createTransport, flush, Hub, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getCurrentScope, getIsolationScope, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, metricsDefault as metrics, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, getActiveSpan, withActiveSpan, getRootSpan, } from '@sentry/core'; | ||
export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, Transaction, User, Span, } from '@sentry/types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const base64WorkerScript = ""; | ||
export declare const base64WorkerScript = "###base64WorkerScript###"; | ||
//# sourceMappingURL=worker-script.d.ts.map |
@@ -18,4 +18,8 @@ interface HttpOptions { | ||
} | ||
/** | ||
* The http integration instruments Node's internal http and https modules. | ||
* It creates breadcrumbs and spans for outgoing HTTP requests which will be attached to the currently active span. | ||
*/ | ||
export declare const httpIntegration: (options?: HttpOptions | undefined) => import("@sentry/types").IntegrationFnResult; | ||
export {}; | ||
//# sourceMappingURL=http.d.ts.map |
@@ -7,2 +7,11 @@ /** | ||
export declare const fastifyIntegration: () => import("@sentry/types").IntegrationFnResult; | ||
interface Fastify { | ||
register: (plugin: unknown) => void; | ||
addHook: (hook: string, handler: (request: unknown, reply: unknown, error: Error) => void) => void; | ||
} | ||
/** | ||
* Setup an error handler for Fastify. | ||
*/ | ||
export declare function setupFastifyErrorHandler(fastify: Fastify): void; | ||
export {}; | ||
//# sourceMappingURL=fastify.d.ts.map |
@@ -29,4 +29,4 @@ /// <reference types="node" /> | ||
*/ | ||
import * as http from 'http'; | ||
import * as https from 'https'; | ||
import * as http from 'node:http'; | ||
import * as https from 'node:https'; | ||
import { Readable } from 'stream'; | ||
@@ -33,0 +33,0 @@ export type ThenableRequest = http.ClientRequest & { |
/// <reference types="node" /> | ||
import { ClientRequest, IncomingHttpHeaders, RequestOptions as HTTPRequestOptions } from 'http'; | ||
import { RequestOptions as HTTPSRequestOptions } from 'https'; | ||
import { ClientRequest, IncomingHttpHeaders, RequestOptions as HTTPRequestOptions } from 'node:http'; | ||
import { RequestOptions as HTTPSRequestOptions } from 'node:https'; | ||
export type HTTPModuleRequestOptions = HTTPRequestOptions | HTTPSRequestOptions | string | URL; | ||
@@ -5,0 +5,0 @@ /** |
import { Span as WriteableSpan } from '@opentelemetry/api'; | ||
import { ReadableSpan, Span } from '@opentelemetry/sdk-trace-base'; | ||
import { ClientOptions, Options, SamplingContext, Scope, TracePropagationTargets } from '@sentry/types'; | ||
import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; | ||
import { ClientOptions, Options, SamplingContext, Scope, Span, TracePropagationTargets } from '@sentry/types'; | ||
import { NodeTransportOptions } from './transports'; | ||
@@ -96,4 +96,3 @@ export interface BaseNodeOptions { | ||
*/ | ||
export type AbstractSpan = WriteableSpan | ReadableSpan; | ||
export { Span }; | ||
export type AbstractSpan = WriteableSpan | ReadableSpan | Span; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -12,3 +12,3 @@ export { httpIntegration } from './integrations/http'; | ||
export { expressIntegration, expressErrorHandler, setupExpressErrorHandler } from './integrations/tracing/express'; | ||
export { fastifyIntegration } from './integrations/tracing/fastify'; | ||
export { fastifyIntegration, setupFastifyErrorHandler } from './integrations/tracing/fastify'; | ||
export { graphqlIntegration } from './integrations/tracing/graphql'; | ||
@@ -23,2 +23,3 @@ export { mongoIntegration } from './integrations/tracing/mongo'; | ||
export { hapiIntegration, setupHapiErrorHandler } from './integrations/tracing/hapi'; | ||
export { spotlightIntegration } from './integrations/spotlight'; | ||
export { init, getDefaultIntegrations } from './sdk/init'; | ||
@@ -32,7 +33,7 @@ export { getAutoPerformanceIntegrations } from './integrations/tracing'; | ||
export { cron } from './cron'; | ||
export type { Span, NodeOptions } from './types'; | ||
export { startSpan, startSpanManual, startInactiveSpan, getActiveSpan, withActiveSpan, } from '@sentry/opentelemetry'; | ||
export type { NodeOptions } from './types'; | ||
export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData, } from '@sentry/utils'; | ||
export { addBreadcrumb, isInitialized, getGlobalScope, close, createTransport, flush, Hub, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, continueTrace, parameterize, getCurrentScope, getIsolationScope, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, } from '@sentry/core'; | ||
export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, Transaction, User, } from '@sentry/types'; | ||
export { continueTrace } from '@sentry/opentelemetry'; | ||
export { addBreadcrumb, isInitialized, getGlobalScope, close, createTransport, flush, Hub, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getCurrentScope, getIsolationScope, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, metricsDefault as metrics, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, getActiveSpan, withActiveSpan, getRootSpan, } from '@sentry/core'; | ||
export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, Request, SdkInfo, Event, EventHint, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, Transaction, User, Span, } from '@sentry/types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const base64WorkerScript = ""; | ||
export declare const base64WorkerScript = "###base64WorkerScript###"; | ||
//# sourceMappingURL=worker-script.d.ts.map |
@@ -18,4 +18,8 @@ interface HttpOptions { | ||
} | ||
/** | ||
* The http integration instruments Node's internal http and https modules. | ||
* It creates breadcrumbs and spans for outgoing HTTP requests which will be attached to the currently active span. | ||
*/ | ||
export declare const httpIntegration: (options?: HttpOptions | undefined) => import("@sentry/types").IntegrationFnResult; | ||
export {}; | ||
//# sourceMappingURL=http.d.ts.map |
@@ -7,2 +7,11 @@ /** | ||
export declare const fastifyIntegration: () => import("@sentry/types").IntegrationFnResult; | ||
interface Fastify { | ||
register: (plugin: unknown) => void; | ||
addHook: (hook: string, handler: (request: unknown, reply: unknown, error: Error) => void) => void; | ||
} | ||
/** | ||
* Setup an error handler for Fastify. | ||
*/ | ||
export declare function setupFastifyErrorHandler(fastify: Fastify): void; | ||
export {}; | ||
//# sourceMappingURL=fastify.d.ts.map |
@@ -33,4 +33,4 @@ /** | ||
/// <reference types="node" /> | ||
import * as http from 'http'; | ||
import * as https from 'https'; | ||
import * as http from 'node:http'; | ||
import * as https from 'node:https'; | ||
import type { Readable } from 'stream'; | ||
@@ -37,0 +37,0 @@ export type ThenableRequest = http.ClientRequest & { |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import type { ClientRequest, IncomingHttpHeaders, RequestOptions as HTTPRequestOptions } from 'http'; | ||
import type { RequestOptions as HTTPSRequestOptions } from 'https'; | ||
import type { ClientRequest, IncomingHttpHeaders, RequestOptions as HTTPRequestOptions } from 'node:http'; | ||
import type { RequestOptions as HTTPSRequestOptions } from 'node:https'; | ||
export type HTTPModuleRequestOptions = HTTPRequestOptions | HTTPSRequestOptions | string | URL; | ||
@@ -7,0 +7,0 @@ /** |
import type { Span as WriteableSpan } from '@opentelemetry/api'; | ||
import type { ReadableSpan, Span } from '@opentelemetry/sdk-trace-base'; | ||
import type { ClientOptions, Options, SamplingContext, Scope, TracePropagationTargets } from '@sentry/types'; | ||
import type { ReadableSpan } from '@opentelemetry/sdk-trace-base'; | ||
import type { ClientOptions, Options, SamplingContext, Scope, Span, TracePropagationTargets } from '@sentry/types'; | ||
import type { NodeTransportOptions } from './transports'; | ||
@@ -96,4 +96,3 @@ export interface BaseNodeOptions { | ||
*/ | ||
export type AbstractSpan = WriteableSpan | ReadableSpan; | ||
export type { Span }; | ||
export type AbstractSpan = WriteableSpan | ReadableSpan | Span; | ||
//# sourceMappingURL=types.d.ts.map |
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 too big to display
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
3867587
25
10603
12
1
186
60
100
+ Added@sentry/core@8.0.0-alpha.3(transitive)
+ Added@sentry/opentelemetry@8.0.0-alpha.3(transitive)
+ Added@sentry/types@8.0.0-alpha.3(transitive)
+ Added@sentry/utils@8.0.0-alpha.3(transitive)
+ Added@types/node@22.7.4(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removed@types/node@14.18.63
- Removed@sentry/core@8.0.0-alpha.2(transitive)
- Removed@sentry/opentelemetry@8.0.0-alpha.2(transitive)
- Removed@sentry/types@8.0.0-alpha.2(transitive)
- Removed@sentry/utils@8.0.0-alpha.2(transitive)
- Removed@types/node@14.18.63(transitive)
Updated@sentry/core@8.0.0-alpha.3
Updated@sentry/types@8.0.0-alpha.3
Updated@sentry/utils@8.0.0-alpha.3