@contember/engine-http 2.2.0-alpha.16 → 2.2.0-alpha.17
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/dist/development/index.cjs +1 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2 -1
- package/dist/development/src/utils/sentry.cjs +3 -3
- package/dist/development/src/utils/sentry.cjs.map +1 -1
- package/dist/development/src/utils/sentry.js +4 -4
- package/dist/development/src/utils/sentry.js.map +1 -1
- package/dist/production/index.cjs +1 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +2 -1
- package/dist/production/src/utils/sentry.cjs +3 -3
- package/dist/production/src/utils/sentry.cjs.map +1 -1
- package/dist/production/src/utils/sentry.js +4 -4
- package/dist/production/src/utils/sentry.js.map +1 -1
- package/dist/tests/cases/unit/sentryIntegrations.test.d.ts +2 -0
- package/dist/tests/cases/unit/sentryIntegrations.test.d.ts.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/utils/sentry.d.ts +4 -0
- package/dist/types/utils/sentry.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/utils/sentry.ts +8 -3
- package/tests/cases/unit/sentryIntegrations.test.ts +15 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Sentry from '@sentry/node';
|
|
1
2
|
import { LogEntry, LoggerHandler, LogLevel } from '@contember/logger';
|
|
2
3
|
export declare class SentryLoggerHandler implements LoggerHandler {
|
|
3
4
|
private readonly logLevel;
|
|
@@ -6,5 +7,8 @@ export declare class SentryLoggerHandler implements LoggerHandler {
|
|
|
6
7
|
handle(entry: LogEntry): void;
|
|
7
8
|
close(): void;
|
|
8
9
|
}
|
|
10
|
+
type SentryIntegration = ReturnType<typeof Sentry.getDefaultIntegrations>[number];
|
|
11
|
+
export declare const filterSentryIntegrations: (integrations: SentryIntegration[]) => SentryIntegration[];
|
|
9
12
|
export declare const createSentryLoggerHandler: (dsn?: string) => null | LoggerHandler;
|
|
13
|
+
export {};
|
|
10
14
|
//# sourceMappingURL=sentry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../../src/utils/sentry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../../src/utils/sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAA2B,MAAM,mBAAmB,CAAA;AAW9F,qBAAa,mBAAoB,YAAW,aAAa;IAEvD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAD1B,YACkB,QAAQ,EAAE,QAAQ,EAEnC;IAED,WAAW,IAAI,MAAM,CAEpB;IAED,MAAM,CAAC,KAAK,EAAE,QAAQ,QA8BrB;IAED,KAAK,IAAI,IAAI,CACZ;CACD;AAED,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAIjF,eAAO,MAAM,wBAAwB,iBAAkB,iBAAiB,EAAE,KAAG,iBAAiB,EACA,CAAA;AAE9F,eAAO,MAAM,yBAAyB,SAAU,MAAM,KAAG,IAAI,GAAG,aAS/D,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/engine-http",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.17",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/production/index.js",
|
|
6
6
|
"typings": "./dist/types/index.d.ts",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@contember/config-loader": "2.2.0-alpha.
|
|
30
|
-
"@contember/database": "2.2.0-alpha.
|
|
31
|
-
"@contember/database-migrations": "2.2.0-alpha.
|
|
32
|
-
"@contember/dic": "2.2.0-alpha.
|
|
33
|
-
"@contember/engine-common": "2.2.0-alpha.
|
|
34
|
-
"@contember/engine-content-api": "2.2.0-alpha.
|
|
35
|
-
"@contember/engine-system-api": "2.2.0-alpha.
|
|
36
|
-
"@contember/engine-tenant-api": "2.2.0-alpha.
|
|
37
|
-
"@contember/graphql-utils": "2.2.0-alpha.
|
|
38
|
-
"@contember/logger": "2.2.0-alpha.
|
|
39
|
-
"@contember/schema": "2.2.0-alpha.
|
|
40
|
-
"@contember/schema-migrations": "2.2.0-alpha.
|
|
41
|
-
"@contember/schema-utils": "2.2.0-alpha.
|
|
42
|
-
"@contember/telemetry": "2.2.0-alpha.
|
|
43
|
-
"@contember/typesafe": "2.2.0-alpha.
|
|
29
|
+
"@contember/config-loader": "2.2.0-alpha.17",
|
|
30
|
+
"@contember/database": "2.2.0-alpha.17",
|
|
31
|
+
"@contember/database-migrations": "2.2.0-alpha.17",
|
|
32
|
+
"@contember/dic": "2.2.0-alpha.17",
|
|
33
|
+
"@contember/engine-common": "2.2.0-alpha.17",
|
|
34
|
+
"@contember/engine-content-api": "2.2.0-alpha.17",
|
|
35
|
+
"@contember/engine-system-api": "2.2.0-alpha.17",
|
|
36
|
+
"@contember/engine-tenant-api": "2.2.0-alpha.17",
|
|
37
|
+
"@contember/graphql-utils": "2.2.0-alpha.17",
|
|
38
|
+
"@contember/logger": "2.2.0-alpha.17",
|
|
39
|
+
"@contember/schema": "2.2.0-alpha.17",
|
|
40
|
+
"@contember/schema-migrations": "2.2.0-alpha.17",
|
|
41
|
+
"@contember/schema-utils": "2.2.0-alpha.17",
|
|
42
|
+
"@contember/telemetry": "2.2.0-alpha.17",
|
|
43
|
+
"@contember/typesafe": "2.2.0-alpha.17",
|
|
44
44
|
"@graphql-tools/merge": "^9.1.7",
|
|
45
45
|
"@graphql-tools/schema": "^10.0.31",
|
|
46
46
|
"@koa/cors": "^5.0.0",
|
package/src/utils/sentry.ts
CHANGED
|
@@ -56,15 +56,20 @@ export class SentryLoggerHandler implements LoggerHandler {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
type SentryIntegration = ReturnType<typeof Sentry.getDefaultIntegrations>[number]
|
|
60
|
+
|
|
61
|
+
// Undici (fetch) would record outgoing request URLs, which may carry a webhook credential in the path or query,
|
|
62
|
+
// in breadcrumbs and spans, and add Sentry trace headers to every webhook request.
|
|
63
|
+
export const filterSentryIntegrations = (integrations: SentryIntegration[]): SentryIntegration[] =>
|
|
64
|
+
integrations.filter(integration => !['Console', 'Http', 'Undici'].includes(integration.name))
|
|
65
|
+
|
|
59
66
|
export const createSentryLoggerHandler = (dsn?: string): null | LoggerHandler => {
|
|
60
67
|
if (!dsn) {
|
|
61
68
|
return null
|
|
62
69
|
}
|
|
63
70
|
Sentry.init({
|
|
64
71
|
dsn: dsn,
|
|
65
|
-
integrations:
|
|
66
|
-
return integrations.filter(integration => integration.name !== 'Console' && integration.name !== 'Http')
|
|
67
|
-
},
|
|
72
|
+
integrations: filterSentryIntegrations,
|
|
68
73
|
})
|
|
69
74
|
return new SentryLoggerHandler(LogLevels.warn)
|
|
70
75
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test'
|
|
2
|
+
import * as Sentry from '@sentry/node'
|
|
3
|
+
import { filterSentryIntegrations } from '../../../src/utils/sentry.js'
|
|
4
|
+
|
|
5
|
+
test('outgoing requests are not instrumented, so their URLs stay out of breadcrumbs and spans', () => {
|
|
6
|
+
const defaults = Sentry.getDefaultIntegrations({}).map(it => it.name)
|
|
7
|
+
expect(defaults).toContain('Undici')
|
|
8
|
+
|
|
9
|
+
const kept = filterSentryIntegrations(Sentry.getDefaultIntegrations({})).map(it => it.name)
|
|
10
|
+
|
|
11
|
+
expect(kept).toContain('LinkedErrors')
|
|
12
|
+
for (const name of ['Undici', 'Http', 'Console']) {
|
|
13
|
+
expect(kept).not.toContain(name)
|
|
14
|
+
}
|
|
15
|
+
})
|