@prairielearn/sentry 2.0.12 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +3 -6
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export declare function init(options: Sentry.NodeOptions): Promise<void>;
|
|
|
18
18
|
* isolate requests and set request data for Sentry.
|
|
19
19
|
*/
|
|
20
20
|
export declare function requestHandler(): (req: any, _res: any, next: any) => void;
|
|
21
|
-
export type { Breadcrumb, BreadcrumbHint, Event, EventHint, Exception, NodeOptions, PolymorphicRequest,
|
|
22
|
-
export { addBreadcrumb, addEventProcessor,
|
|
21
|
+
export type { Breadcrumb, BreadcrumbHint, Event, EventHint, Exception, NodeOptions, PolymorphicRequest, SdkInfo, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, } from '@sentry/node';
|
|
22
|
+
export { addBreadcrumb, addEventProcessor, captureEvent, captureException, captureMessage, close, createTransport, defaultStackParser, expressErrorHandler, expressIntegration, flush, getCurrentScope, getSentryRelease, makeNodeTransport, NodeClient, Scope, SDK_VERSION, SentryContextManager, setContext, setExtra, setExtras, setTag, setTags, setupExpressErrorHandler, setUser, startInactiveSpan, startSpan, startSpanManual, withIsolationScope, withScope, } from '@sentry/node';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { httpRequestToRequestData, stripUrlQueryAndFragment } from '@sentry/core';
|
|
1
2
|
import * as Sentry from '@sentry/node';
|
|
2
|
-
import { stripUrlQueryAndFragment } from '@sentry/utils';
|
|
3
3
|
import { execa } from 'execa';
|
|
4
4
|
/**
|
|
5
5
|
* A thin wrapper around {@link Sentry.init} that automatically sets `release`
|
|
@@ -63,7 +63,8 @@ export function requestHandler() {
|
|
|
63
63
|
// swallow any errors.
|
|
64
64
|
try {
|
|
65
65
|
event.transaction = extractTransaction(req);
|
|
66
|
-
|
|
66
|
+
event.request = httpRequestToRequestData(req);
|
|
67
|
+
return event;
|
|
67
68
|
}
|
|
68
69
|
catch {
|
|
69
70
|
return event;
|
|
@@ -73,5 +74,5 @@ export function requestHandler() {
|
|
|
73
74
|
});
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
|
-
export { addBreadcrumb, addEventProcessor,
|
|
77
|
+
export { addBreadcrumb, addEventProcessor, captureEvent, captureException, captureMessage, close, createTransport, defaultStackParser, expressErrorHandler, expressIntegration, flush, getCurrentScope, getSentryRelease, makeNodeTransport, NodeClient, Scope, SDK_VERSION, SentryContextManager, setContext, setExtra, setExtras, setTag, setTags, setupExpressErrorHandler, setUser, startInactiveSpan, startSpan, startSpanManual, withIsolationScope, withScope, } from '@sentry/node';
|
|
77
78
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAA2B;IACpD,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAE9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,CAAC;YACH,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACt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EH,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAuBD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,KAAK,EACL,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,wBAAwB,EACxB,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,SAAS,GACV,MAAM,cAAc,CAAC","sourcesContent":["import { httpRequestToRequestData, stripUrlQueryAndFragment } from '@sentry/core';\nimport * as Sentry from '@sentry/node';\nimport { execa } from 'execa';\n\n/**\n * A thin wrapper around {@link Sentry.init} that automatically sets `release`\n * based on the current Git revision.\n */\nexport async function init(options: Sentry.NodeOptions) {\n let release = options.release;\n\n if (!release) {\n try {\n release = (await execa('git', ['rev-parse', 'HEAD'])).stdout.trim();\n } catch {\n // This most likely isn't running in an initialized git repository.\n // Default to not setting a release.\n }\n }\n\n Sentry.init({\n release,\n ...options,\n });\n}\n\n/**\n * Based on Sentry code that is not exported:\n * https://github.com/getsentry/sentry-javascript/blob/602703652959b581304a7849cb97117f296493bc/packages/utils/src/requestdata.ts#L102\n */\nfunction extractTransaction(req: any) {\n const method = req.method?.toUpperCase() || '';\n const path = stripUrlQueryAndFragment(req.originalUrl || req.url || '');\n\n let name = '';\n if (method) {\n name += method;\n }\n if (method && path) {\n name += ' ';\n }\n if (path) {\n name += path;\n }\n\n return name;\n}\n\n/**\n * Sentry v8 switched from simple, manual instrumentation to \"automatic\"\n * instrumentation based on OpenTelemetry. However, this interferes with\n * the way that our applications asynchronously load their configuration,\n * specifically the Sentry DSN. Sentry's automatic request isolation and\n * request data extraction requires that `Sentry.init` be called before\n * any other code is loaded, but our application startup structure is such\n * that we import most of our own code before we can load the Sentry DSN.\n *\n * Rather than jumping through hoops to restructure our application to\n * support this, this small function can be added as Express middleware to\n * isolate requests and set request data for Sentry.\n */\nexport function requestHandler() {\n return (req: any, _res: any, next: any) => {\n Sentry.withIsolationScope((scope) => {\n scope.addEventProcessor((event) => {\n // If an event processor throws an error, Sentry will catch it and\n // retrigger the event processor, which infinitely recurses. We'll\n // treat our event processor as a best-effort operation and silently\n // swallow any errors.\n try {\n event.transaction = extractTransaction(req);\n event.request = httpRequestToRequestData(req);\n return event;\n } catch {\n return event;\n }\n });\n\n next();\n });\n };\n}\n\n// We export every type and function from `@sentry/node` *except* for init,\n// which we replace with our own version up above.\n\nexport type {\n Breadcrumb,\n BreadcrumbHint,\n Event,\n EventHint,\n Exception,\n NodeOptions,\n PolymorphicRequest,\n SdkInfo,\n Session,\n SeverityLevel,\n Span,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n} from '@sentry/node';\n\nexport {\n addBreadcrumb,\n addEventProcessor,\n captureEvent,\n captureException,\n captureMessage,\n close,\n createTransport,\n defaultStackParser,\n expressErrorHandler,\n expressIntegration,\n flush,\n getCurrentScope,\n getSentryRelease,\n makeNodeTransport,\n NodeClient,\n Scope,\n SDK_VERSION,\n SentryContextManager,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setupExpressErrorHandler,\n setUser,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n withIsolationScope,\n withScope,\n} from '@sentry/node';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prairielearn/sentry",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@prairielearn/tsconfig": "^0.0.0",
|
|
17
|
-
"@types/node": "^20.17.
|
|
18
|
-
"tsx": "^4.19.
|
|
19
|
-
"typescript": "^5.
|
|
17
|
+
"@types/node": "^20.17.23",
|
|
18
|
+
"tsx": "^4.19.3",
|
|
19
|
+
"typescript": "^5.8.2"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sentry/
|
|
23
|
-
"@sentry/
|
|
22
|
+
"@sentry/core": "^9.3.0",
|
|
23
|
+
"@sentry/node": "^9.3.0",
|
|
24
24
|
"execa": "^9.5.2"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { httpRequestToRequestData, stripUrlQueryAndFragment } from '@sentry/core';
|
|
1
2
|
import * as Sentry from '@sentry/node';
|
|
2
|
-
import { stripUrlQueryAndFragment } from '@sentry/utils';
|
|
3
3
|
import { execa } from 'execa';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -69,7 +69,8 @@ export function requestHandler() {
|
|
|
69
69
|
// swallow any errors.
|
|
70
70
|
try {
|
|
71
71
|
event.transaction = extractTransaction(req);
|
|
72
|
-
|
|
72
|
+
event.request = httpRequestToRequestData(req);
|
|
73
|
+
return event;
|
|
73
74
|
} catch {
|
|
74
75
|
return event;
|
|
75
76
|
}
|
|
@@ -91,7 +92,6 @@ export type {
|
|
|
91
92
|
Exception,
|
|
92
93
|
NodeOptions,
|
|
93
94
|
PolymorphicRequest,
|
|
94
|
-
Request,
|
|
95
95
|
SdkInfo,
|
|
96
96
|
Session,
|
|
97
97
|
SeverityLevel,
|
|
@@ -105,7 +105,6 @@ export type {
|
|
|
105
105
|
export {
|
|
106
106
|
addBreadcrumb,
|
|
107
107
|
addEventProcessor,
|
|
108
|
-
addRequestDataToEvent,
|
|
109
108
|
captureEvent,
|
|
110
109
|
captureException,
|
|
111
110
|
captureMessage,
|
|
@@ -114,9 +113,7 @@ export {
|
|
|
114
113
|
defaultStackParser,
|
|
115
114
|
expressErrorHandler,
|
|
116
115
|
expressIntegration,
|
|
117
|
-
extractRequestData,
|
|
118
116
|
flush,
|
|
119
|
-
getCurrentHub,
|
|
120
117
|
getCurrentScope,
|
|
121
118
|
getSentryRelease,
|
|
122
119
|
makeNodeTransport,
|