@sentry/google-cloud-serverless 8.0.0-alpha.4
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/LICENSE +14 -0
- package/README.md +47 -0
- package/cjs/debug-build.js +11 -0
- package/cjs/debug-build.js.map +1 -0
- package/cjs/gcpfunction/cloud_events.js +82 -0
- package/cjs/gcpfunction/cloud_events.js.map +1 -0
- package/cjs/gcpfunction/events.js +87 -0
- package/cjs/gcpfunction/events.js.map +1 -0
- package/cjs/gcpfunction/http.js +98 -0
- package/cjs/gcpfunction/http.js.map +1 -0
- package/cjs/index.js +115 -0
- package/cjs/index.js.map +1 -0
- package/cjs/integrations/google-cloud-grpc.js +114 -0
- package/cjs/integrations/google-cloud-grpc.js.map +1 -0
- package/cjs/integrations/google-cloud-http.js +65 -0
- package/cjs/integrations/google-cloud-http.js.map +1 -0
- package/cjs/sdk.js +42 -0
- package/cjs/sdk.js.map +1 -0
- package/cjs/utils.js +60 -0
- package/cjs/utils.js.map +1 -0
- package/esm/debug-build.js +9 -0
- package/esm/debug-build.js.map +1 -0
- package/esm/gcpfunction/cloud_events.js +80 -0
- package/esm/gcpfunction/cloud_events.js.map +1 -0
- package/esm/gcpfunction/events.js +85 -0
- package/esm/gcpfunction/events.js.map +1 -0
- package/esm/gcpfunction/http.js +93 -0
- package/esm/gcpfunction/http.js.map +1 -0
- package/esm/index.js +9 -0
- package/esm/index.js.map +1 -0
- package/esm/integrations/google-cloud-grpc.js +109 -0
- package/esm/integrations/google-cloud-grpc.js.map +1 -0
- package/esm/integrations/google-cloud-http.js +63 -0
- package/esm/integrations/google-cloud-http.js.map +1 -0
- package/esm/package.json +1 -0
- package/esm/sdk.js +39 -0
- package/esm/sdk.js.map +1 -0
- package/esm/utils.js +56 -0
- package/esm/utils.js.map +1 -0
- package/package.json +58 -0
- package/types/debug-build.d.ts +7 -0
- package/types/debug-build.d.ts.map +1 -0
- package/types/gcpfunction/cloud_events.d.ts +11 -0
- package/types/gcpfunction/cloud_events.d.ts.map +1 -0
- package/types/gcpfunction/events.d.ts +11 -0
- package/types/gcpfunction/events.d.ts.map +1 -0
- package/types/gcpfunction/general.d.ts +38 -0
- package/types/gcpfunction/general.d.ts.map +1 -0
- package/types/gcpfunction/http.d.ts +10 -0
- package/types/gcpfunction/http.d.ts.map +1 -0
- package/types/index.d.ts +9 -0
- package/types/index.d.ts.map +1 -0
- package/types/integrations/google-cloud-grpc.d.ts +7 -0
- package/types/integrations/google-cloud-grpc.d.ts.map +1 -0
- package/types/integrations/google-cloud-http.d.ts +7 -0
- package/types/integrations/google-cloud-http.d.ts.map +1 -0
- package/types/sdk.d.ts +9 -0
- package/types/sdk.d.ts.map +1 -0
- package/types/utils.d.ts +18 -0
- package/types/utils.d.ts.map +1 -0
- package/types-ts3.8/debug-build.d.ts +7 -0
- package/types-ts3.8/gcpfunction/cloud_events.d.ts +11 -0
- package/types-ts3.8/gcpfunction/events.d.ts +11 -0
- package/types-ts3.8/gcpfunction/general.d.ts +38 -0
- package/types-ts3.8/gcpfunction/http.d.ts +10 -0
- package/types-ts3.8/index.d.ts +9 -0
- package/types-ts3.8/integrations/google-cloud-grpc.d.ts +7 -0
- package/types-ts3.8/integrations/google-cloud-http.d.ts +7 -0
- package/types-ts3.8/sdk.d.ts +9 -0
- package/types-ts3.8/utils.d.ts +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Copyright (c) 2024 Sentry (https://sentry.io) and individual contributors. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
4
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
5
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
6
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
9
|
+
Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
12
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
13
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
14
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
|
|
3
|
+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# Official Sentry SDK for Google Cloud Functions
|
|
8
|
+
|
|
9
|
+
## Links
|
|
10
|
+
|
|
11
|
+
- [Official SDK Docs](https://docs.sentry.io/)
|
|
12
|
+
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
|
|
13
|
+
|
|
14
|
+
## General
|
|
15
|
+
|
|
16
|
+
This package is a wrapper around `@sentry/node`, with added functionality related to various Serverless solutions. All
|
|
17
|
+
methods available in `@sentry/node` can be imported from `@sentry/google-cloud-serverless`.
|
|
18
|
+
|
|
19
|
+
To use this SDK, call `Sentry.init(options)` at the very beginning of your JavaScript file.
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
const Sentry = require('@sentry/google-cloud-serverless');
|
|
23
|
+
|
|
24
|
+
Sentry.init({
|
|
25
|
+
dsn: '__DSN__',
|
|
26
|
+
tracesSampleRate: 1.0,
|
|
27
|
+
// ...
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// For HTTP Functions:
|
|
31
|
+
|
|
32
|
+
exports.helloHttp = Sentry.wrapHttpFunction((req, res) => {
|
|
33
|
+
throw new Error('oh, hello there!');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// For Background Functions:
|
|
37
|
+
|
|
38
|
+
exports.helloEvents = Sentry.wrapEventFunction((data, context, callback) => {
|
|
39
|
+
throw new Error('oh, hello there!');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// For CloudEvents:
|
|
43
|
+
|
|
44
|
+
exports.helloEvents = Sentry.wrapCloudEventFunction((context, callback) => {
|
|
45
|
+
throw new Error('oh, hello there!');
|
|
46
|
+
});
|
|
47
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
|
5
|
+
*
|
|
6
|
+
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
7
|
+
*/
|
|
8
|
+
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
9
|
+
|
|
10
|
+
exports.DEBUG_BUILD = DEBUG_BUILD;
|
|
11
|
+
//# sourceMappingURL=debug-build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-build.js","sources":["../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAY,IAAE,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const node = require('@sentry/node');
|
|
5
|
+
const utils$1 = require('@sentry/utils');
|
|
6
|
+
const debugBuild = require('../debug-build.js');
|
|
7
|
+
const utils = require('../utils.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Wraps an event function handler adding it error capture and tracing capabilities.
|
|
11
|
+
*
|
|
12
|
+
* @param fn Event handler
|
|
13
|
+
* @param options Options
|
|
14
|
+
* @returns Event handler
|
|
15
|
+
*/
|
|
16
|
+
function wrapCloudEventFunction(
|
|
17
|
+
fn,
|
|
18
|
+
wrapOptions = {},
|
|
19
|
+
) {
|
|
20
|
+
return utils.proxyFunction(fn, f => utils.domainify(_wrapCloudEventFunction(f, wrapOptions)));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function _wrapCloudEventFunction(
|
|
24
|
+
fn,
|
|
25
|
+
wrapOptions = {},
|
|
26
|
+
) {
|
|
27
|
+
const options = {
|
|
28
|
+
flushTimeout: 2000,
|
|
29
|
+
...wrapOptions,
|
|
30
|
+
};
|
|
31
|
+
return (context, callback) => {
|
|
32
|
+
return node.startSpanManual(
|
|
33
|
+
{
|
|
34
|
+
name: context.type || '<unknown>',
|
|
35
|
+
op: 'function.gcp.cloud_event',
|
|
36
|
+
attributes: {
|
|
37
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
|
|
38
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
span => {
|
|
42
|
+
const scope = node.getCurrentScope();
|
|
43
|
+
scope.setContext('gcp.function.context', { ...context });
|
|
44
|
+
|
|
45
|
+
const newCallback = utils.domainify((...args) => {
|
|
46
|
+
if (args[0] !== null && args[0] !== undefined) {
|
|
47
|
+
node.captureException(args[0], scope => utils.markEventUnhandled(scope));
|
|
48
|
+
}
|
|
49
|
+
span.end();
|
|
50
|
+
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
52
|
+
node.flush(options.flushTimeout)
|
|
53
|
+
.then(null, e => {
|
|
54
|
+
debugBuild.DEBUG_BUILD && utils$1.logger.error(e);
|
|
55
|
+
})
|
|
56
|
+
.then(() => {
|
|
57
|
+
callback(...args);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (fn.length > 1) {
|
|
62
|
+
return core.handleCallbackErrors(
|
|
63
|
+
() => (fn )(context, newCallback),
|
|
64
|
+
err => {
|
|
65
|
+
node.captureException(err, scope => utils.markEventUnhandled(scope));
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return Promise.resolve()
|
|
71
|
+
.then(() => (fn )(context))
|
|
72
|
+
.then(
|
|
73
|
+
result => newCallback(null, result),
|
|
74
|
+
err => newCallback(err, undefined),
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
exports.wrapCloudEventFunction = wrapCloudEventFunction;
|
|
82
|
+
//# sourceMappingURL=cloud_events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud_events.js","sources":["../../../src/gcpfunction/cloud_events.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, handleCallbackErrors } from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, markEventUnhandled, proxyFunction } from '../utils';\nimport type { CloudEventFunction, CloudEventFunctionWithCallback, WrapperOptions } from './general';\n\nexport type CloudEventFunctionWrapperOptions = WrapperOptions;\n\n/**\n * Wraps an event function handler adding it error capture and tracing capabilities.\n *\n * @param fn Event handler\n * @param options Options\n * @returns Event handler\n */\nexport function wrapCloudEventFunction(\n fn: CloudEventFunction | CloudEventFunctionWithCallback,\n wrapOptions: Partial<CloudEventFunctionWrapperOptions> = {},\n): CloudEventFunctionWithCallback {\n return proxyFunction(fn, f => domainify(_wrapCloudEventFunction(f, wrapOptions)));\n}\n\nfunction _wrapCloudEventFunction(\n fn: CloudEventFunction | CloudEventFunctionWithCallback,\n wrapOptions: Partial<CloudEventFunctionWrapperOptions> = {},\n): CloudEventFunctionWithCallback {\n const options: CloudEventFunctionWrapperOptions = {\n flushTimeout: 2000,\n ...wrapOptions,\n };\n return (context, callback) => {\n return startSpanManual(\n {\n name: context.type || '<unknown>',\n op: 'function.gcp.cloud_event',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event',\n },\n },\n span => {\n const scope = getCurrentScope();\n scope.setContext('gcp.function.context', { ...context });\n\n const newCallback = domainify((...args: unknown[]) => {\n if (args[0] !== null && args[0] !== undefined) {\n captureException(args[0], scope => markEventUnhandled(scope));\n }\n span.end();\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n flush(options.flushTimeout)\n .then(null, e => {\n DEBUG_BUILD && logger.error(e);\n })\n .then(() => {\n callback(...args);\n });\n });\n\n if (fn.length > 1) {\n return handleCallbackErrors(\n () => (fn as CloudEventFunctionWithCallback)(context, newCallback),\n err => {\n captureException(err, scope => markEventUnhandled(scope));\n },\n );\n }\n\n return Promise.resolve()\n .then(() => (fn as CloudEventFunction)(context))\n .then(\n result => newCallback(null, result),\n err => newCallback(err, undefined),\n );\n },\n );\n };\n}\n"],"names":["proxyFunction","domainify","startSpanManual","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getCurrentScope","captureException","markEventUnhandled","flush","DEBUG_BUILD","logger","handleCallbackErrors"],"mappings":";;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB;AACtC,EAAE,EAAE;AACJ,EAAE,WAAW,GAA8C,EAAE;AAC7D,EAAkC;AAClC,EAAE,OAAOA,mBAAa,CAAC,EAAE,EAAE,KAAKC,eAAS,CAAC,uBAAuB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;AACnF,CAAA;AACA;AACA,SAAS,uBAAuB;AAChC,EAAE,EAAE;AACJ,EAAE,WAAW,GAA8C,EAAE;AAC7D,EAAkC;AAClC,EAAE,MAAM,OAAO,GAAqC;AACpD,IAAI,YAAY,EAAE,IAAI;AACtB,IAAI,GAAG,WAAW;AAClB,GAAG,CAAA;AACH,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,KAAK;AAChC,IAAI,OAAOC,oBAAe;AAC1B,MAAM;AACN,QAAQ,IAAI,EAAE,OAAO,CAAC,IAAA,IAAQ,WAAW;AACzC,QAAQ,EAAE,EAAE,0BAA0B;AACtC,QAAQ,UAAU,EAAE;AACpB,UAAU,CAACC,qCAAgC,GAAG,WAAW;AACzD,UAAU,CAACC,qCAAgC,GAAG,0CAA0C;AACxF,SAAS;AACT,OAAO;AACP,MAAM,QAAQ;AACd,QAAQ,MAAM,KAAA,GAAQC,oBAAe,EAAE,CAAA;AACvC,QAAQ,KAAK,CAAC,UAAU,CAAC,sBAAsB,EAAE,EAAE,GAAG,OAAQ,EAAC,CAAC,CAAA;AAChE;AACA,QAAQ,MAAM,cAAcJ,eAAS,CAAC,CAAC,GAAG,IAAI,KAAgB;AAC9D,UAAU,IAAI,IAAI,CAAC,CAAC,CAAE,KAAI,IAAK,IAAG,IAAI,CAAC,CAAC,CAAE,KAAI,SAAS,EAAE;AACzD,YAAYK,qBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAA,IAASC,wBAAkB,CAAC,KAAK,CAAC,CAAC,CAAA;AACzE,WAAU;AACV,UAAU,IAAI,CAAC,GAAG,EAAE,CAAA;AACpB;AACA;AACA,UAAUC,UAAK,CAAC,OAAO,CAAC,YAAY,CAAA;AACpC,aAAa,IAAI,CAAC,IAAI,EAAE,KAAK;AAC7B,cAAcC,0BAAeC,cAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAC5C,aAAa,CAAA;AACb,aAAa,IAAI,CAAC,MAAM;AACxB,cAAc,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;AAC/B,aAAa,CAAC,CAAA;AACd,SAAS,CAAC,CAAA;AACV;AACA,QAAQ,IAAI,EAAE,CAAC,MAAO,GAAE,CAAC,EAAE;AAC3B,UAAU,OAAOC,yBAAoB;AACrC,YAAY,MAAM,CAAC,EAAA,GAAsC,OAAO,EAAE,WAAW,CAAC;AAC9E,YAAY,OAAO;AACnB,cAAcL,qBAAgB,CAAC,GAAG,EAAE,KAAA,IAASC,wBAAkB,CAAC,KAAK,CAAC,CAAC,CAAA;AACvE,aAAa;AACb,WAAW,CAAA;AACX,SAAQ;AACR;AACA,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAC;AAC/B,WAAW,IAAI,CAAC,MAAM,CAAC,EAAG,GAAuB,OAAO,CAAC,CAAA;AACzD,WAAW,IAAI;AACf,YAAY,UAAU,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;AAC/C,YAAY,OAAO,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC;AAC9C,WAAW,CAAA;AACX,OAAO;AACP,KAAK,CAAA;AACL,GAAG,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const node = require('@sentry/node');
|
|
5
|
+
const utils$1 = require('@sentry/utils');
|
|
6
|
+
const debugBuild = require('../debug-build.js');
|
|
7
|
+
const utils = require('../utils.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Wraps an event function handler adding it error capture and tracing capabilities.
|
|
11
|
+
*
|
|
12
|
+
* @param fn Event handler
|
|
13
|
+
* @param options Options
|
|
14
|
+
* @returns Event handler
|
|
15
|
+
*/
|
|
16
|
+
function wrapEventFunction(
|
|
17
|
+
fn,
|
|
18
|
+
wrapOptions = {},
|
|
19
|
+
) {
|
|
20
|
+
return utils.proxyFunction(fn, f => utils.domainify(_wrapEventFunction(f, wrapOptions)));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** */
|
|
24
|
+
function _wrapEventFunction(
|
|
25
|
+
fn,
|
|
26
|
+
wrapOptions = {},
|
|
27
|
+
) {
|
|
28
|
+
const options = {
|
|
29
|
+
flushTimeout: 2000,
|
|
30
|
+
...wrapOptions,
|
|
31
|
+
};
|
|
32
|
+
return (...eventFunctionArguments) => {
|
|
33
|
+
const [data, context, callback] = eventFunctionArguments;
|
|
34
|
+
|
|
35
|
+
return node.startSpanManual(
|
|
36
|
+
{
|
|
37
|
+
name: context.eventType,
|
|
38
|
+
op: 'function.gcp.event',
|
|
39
|
+
attributes: {
|
|
40
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
|
|
41
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
span => {
|
|
45
|
+
const scope = node.getCurrentScope();
|
|
46
|
+
scope.setContext('gcp.function.context', { ...context });
|
|
47
|
+
|
|
48
|
+
const newCallback = utils.domainify((...args) => {
|
|
49
|
+
if (args[0] !== null && args[0] !== undefined) {
|
|
50
|
+
node.captureException(args[0], scope => utils.markEventUnhandled(scope));
|
|
51
|
+
}
|
|
52
|
+
span.end();
|
|
53
|
+
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
55
|
+
node.flush(options.flushTimeout)
|
|
56
|
+
.then(null, e => {
|
|
57
|
+
debugBuild.DEBUG_BUILD && utils$1.logger.error(e);
|
|
58
|
+
})
|
|
59
|
+
.then(() => {
|
|
60
|
+
if (typeof callback === 'function') {
|
|
61
|
+
callback(...args);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (fn.length > 2) {
|
|
67
|
+
return core.handleCallbackErrors(
|
|
68
|
+
() => (fn )(data, context, newCallback),
|
|
69
|
+
err => {
|
|
70
|
+
node.captureException(err, scope => utils.markEventUnhandled(scope));
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return Promise.resolve()
|
|
76
|
+
.then(() => (fn )(data, context))
|
|
77
|
+
.then(
|
|
78
|
+
result => newCallback(null, result),
|
|
79
|
+
err => newCallback(err, undefined),
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
exports.wrapEventFunction = wrapEventFunction;
|
|
87
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sources":["../../../src/gcpfunction/events.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, handleCallbackErrors } from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, markEventUnhandled, proxyFunction } from '../utils';\nimport type { EventFunction, EventFunctionWithCallback, WrapperOptions } from './general';\n\nexport type EventFunctionWrapperOptions = WrapperOptions;\n\n/**\n * Wraps an event function handler adding it error capture and tracing capabilities.\n *\n * @param fn Event handler\n * @param options Options\n * @returns Event handler\n */\nexport function wrapEventFunction(\n fn: EventFunction | EventFunctionWithCallback,\n wrapOptions: Partial<EventFunctionWrapperOptions> = {},\n): EventFunctionWithCallback {\n return proxyFunction(fn, f => domainify(_wrapEventFunction(f, wrapOptions)));\n}\n\n/** */\nfunction _wrapEventFunction<F extends EventFunction | EventFunctionWithCallback>(\n fn: F,\n wrapOptions: Partial<EventFunctionWrapperOptions> = {},\n): (...args: Parameters<F>) => ReturnType<F> | Promise<void> {\n const options: EventFunctionWrapperOptions = {\n flushTimeout: 2000,\n ...wrapOptions,\n };\n return (...eventFunctionArguments: Parameters<F>): ReturnType<F> | Promise<void> => {\n const [data, context, callback] = eventFunctionArguments;\n\n return startSpanManual(\n {\n name: context.eventType,\n op: 'function.gcp.event',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event',\n },\n },\n span => {\n const scope = getCurrentScope();\n scope.setContext('gcp.function.context', { ...context });\n\n const newCallback = domainify((...args: unknown[]) => {\n if (args[0] !== null && args[0] !== undefined) {\n captureException(args[0], scope => markEventUnhandled(scope));\n }\n span.end();\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n flush(options.flushTimeout)\n .then(null, e => {\n DEBUG_BUILD && logger.error(e);\n })\n .then(() => {\n if (typeof callback === 'function') {\n callback(...args);\n }\n });\n });\n\n if (fn.length > 2) {\n return handleCallbackErrors(\n () => (fn as EventFunctionWithCallback)(data, context, newCallback),\n err => {\n captureException(err, scope => markEventUnhandled(scope));\n },\n );\n }\n\n return Promise.resolve()\n .then(() => (fn as EventFunction)(data, context))\n .then(\n result => newCallback(null, result),\n err => newCallback(err, undefined),\n );\n },\n );\n };\n}\n"],"names":["proxyFunction","domainify","startSpanManual","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getCurrentScope","captureException","markEventUn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require('@sentry/utils');
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
|
+
|
|
7
|
+
const core = require('@sentry/core');
|
|
8
|
+
const node = require('@sentry/node');
|
|
9
|
+
const utils$1 = require('@sentry/utils');
|
|
10
|
+
const debugBuild = require('../debug-build.js');
|
|
11
|
+
const utils = require('../utils.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Wraps an HTTP function handler adding it error capture and tracing capabilities.
|
|
15
|
+
*
|
|
16
|
+
* @param fn HTTP Handler
|
|
17
|
+
* @param options Options
|
|
18
|
+
* @returns HTTP handler
|
|
19
|
+
*/
|
|
20
|
+
function wrapHttpFunction(fn, wrapOptions = {}) {
|
|
21
|
+
const wrap = (f) => utils.domainify(_wrapHttpFunction(f, wrapOptions));
|
|
22
|
+
|
|
23
|
+
let overrides;
|
|
24
|
+
|
|
25
|
+
// Functions emulator from firebase-tools has a hack-ish workaround that saves the actual function
|
|
26
|
+
// passed to `onRequest(...)` and in fact runs it so we need to wrap it too.
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
28
|
+
const emulatorFunc = (fn ).__emulator_func ;
|
|
29
|
+
if (emulatorFunc) {
|
|
30
|
+
overrides = { __emulator_func: utils.proxyFunction(emulatorFunc, wrap) };
|
|
31
|
+
}
|
|
32
|
+
return utils.proxyFunction(fn, wrap, overrides);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** */
|
|
36
|
+
function _wrapHttpFunction(fn, options) {
|
|
37
|
+
const flushTimeout = options.flushTimeout || 2000;
|
|
38
|
+
return (req, res) => {
|
|
39
|
+
const reqMethod = (req.method || '').toUpperCase();
|
|
40
|
+
const reqUrl = utils$1.stripUrlQueryAndFragment(req.originalUrl || req.url || '');
|
|
41
|
+
|
|
42
|
+
const sentryTrace = req.headers && utils$1.isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;
|
|
43
|
+
const baggage = _optionalChain([req, 'access', _ => _.headers, 'optionalAccess', _2 => _2.baggage]);
|
|
44
|
+
|
|
45
|
+
return node.continueTrace({ sentryTrace, baggage }, () => {
|
|
46
|
+
return node.startSpanManual(
|
|
47
|
+
{
|
|
48
|
+
name: `${reqMethod} ${reqUrl}`,
|
|
49
|
+
op: 'function.gcp.http',
|
|
50
|
+
attributes: {
|
|
51
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
|
|
52
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
span => {
|
|
56
|
+
node.getCurrentScope().setSDKProcessingMetadata({
|
|
57
|
+
request: req,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (span instanceof core.Transaction) {
|
|
61
|
+
// We also set __sentry_transaction on the response so people can grab the transaction there to add
|
|
62
|
+
// spans to it later.
|
|
63
|
+
// TODO(v8): Remove this
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
65
|
+
(res ).__sentry_transaction = span;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
69
|
+
const _end = res.end;
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
+
res.end = function (chunk, encoding, cb) {
|
|
72
|
+
core.setHttpStatus(span, res.statusCode);
|
|
73
|
+
span.end();
|
|
74
|
+
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
76
|
+
node.flush(flushTimeout)
|
|
77
|
+
.then(null, e => {
|
|
78
|
+
debugBuild.DEBUG_BUILD && utils$1.logger.error(e);
|
|
79
|
+
})
|
|
80
|
+
.then(() => {
|
|
81
|
+
_end.call(this, chunk, encoding, cb);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return core.handleCallbackErrors(
|
|
86
|
+
() => fn(req, res),
|
|
87
|
+
err => {
|
|
88
|
+
node.captureException(err, scope => utils.markEventUnhandled(scope));
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
exports.wrapHttpFunction = wrapHttpFunction;
|
|
98
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n Transaction,\n handleCallbackErrors,\n setHttpStatus,\n} from '@sentry/core';\nimport { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { isString, logger, stripUrlQueryAndFragment } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, markEventUnhandled, proxyFunction } from '../utils';\nimport type { HttpFunction, WrapperOptions } from './general';\n\n/**\n * Wraps an HTTP function handler adding it error capture and tracing capabilities.\n *\n * @param fn HTTP Handler\n * @param options Options\n * @returns HTTP handler\n */\nexport function wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial<WrapperOptions> = {}): HttpFunction {\n const wrap = (f: HttpFunction): HttpFunction => domainify(_wrapHttpFunction(f, wrapOptions));\n\n let overrides: Record<PropertyKey, unknown> | undefined;\n\n // Functions emulator from firebase-tools has a hack-ish workaround that saves the actual function\n // passed to `onRequest(...)` and in fact runs it so we need to wrap it too.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const emulatorFunc = (fn as any).__emulator_func as HttpFunction | undefined;\n if (emulatorFunc) {\n overrides = { __emulator_func: proxyFunction(emulatorFunc, wrap) };\n }\n return proxyFunction(fn, wrap, overrides);\n}\n\n/** */\nfunction _wrapHttpFunction(fn: HttpFunction, options: Partial<WrapperOptions>): HttpFunction {\n const flushTimeout = options.flushTimeout || 2000;\n return (req, res) => {\n const reqMethod = (req.method || '').toUpperCase();\n const reqUrl = stripUrlQueryAndFragment(req.originalUrl || req.url || '');\n\n const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;\n const baggage = req.headers?.baggage;\n\n return continueTrace({ sentryTrace, baggage }, () => {\n return startSpanManual(\n {\n name: `${reqMethod} ${reqUrl}`,\n op: 'function.gcp.http',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n },\n },\n span => {\n getCurrentScope().setSDKProcessingMetadata({\n request: req,\n });\n\n if (span instanceof Transaction) {\n // We also set __sentry_transaction on the response so people can grab the transaction there to add\n // spans to it later.\n // TODO(v8): Remove this\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n (res as any).__sentry_transaction = span;\n }\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const _end = res.end;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n res.end = function (chunk?: any | (() => void), encoding?: string | (() => void), cb?: () => void): any {\n setHttpStatus(span, res.statusCode);\n span.end();\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n flush(flushTimeout)\n .then(null, e => {\n DEBUG_BUILD && logger.error(e);\n })\n .then(() => {\n _end.call(this, chunk, encoding, cb);\n });\n };\n\n return handleCallbackErrors(\n () => fn(req, res),\n err => {\n captureException(err, scope => markEventUnhandled(scope));\n },\n );\n },\n );\n });\n };\n}\n"],"names":["domainify","proxyFunction","stripUrlQueryAndFragment","isString","continueTrace","startSpanManual","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getCurrentScope","Transaction","setHttpStatus","flush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,CAAA,CAAA,CAAA,CAAA;YACA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,CAAA;YACA,IAAA,CAAA,EAAA;cACAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAAC,CAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;YACA,CAAA;UACA,CAAA;QACA,CAAA;MACA,CAAA;IACA,CAAA,CAAA;EACA,CAAA;AACA;;"}
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
const node = require('@sentry/node');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const sdk = require('./sdk.js');
|
|
6
|
+
const googleCloudHttp = require('./integrations/google-cloud-http.js');
|
|
7
|
+
const googleCloudGrpc = require('./integrations/google-cloud-grpc.js');
|
|
8
|
+
const cloud_events = require('./gcpfunction/cloud_events.js');
|
|
9
|
+
const http = require('./gcpfunction/http.js');
|
|
10
|
+
const events = require('./gcpfunction/events.js');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.DEFAULT_USER_INCLUDES = node.DEFAULT_USER_INCLUDES;
|
|
15
|
+
exports.Hub = node.Hub;
|
|
16
|
+
exports.NodeClient = node.NodeClient;
|
|
17
|
+
exports.SDK_VERSION = node.SDK_VERSION;
|
|
18
|
+
exports.SEMANTIC_ATTRIBUTE_SENTRY_OP = node.SEMANTIC_ATTRIBUTE_SENTRY_OP;
|
|
19
|
+
exports.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = node.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
|
|
20
|
+
exports.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = node.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE;
|
|
21
|
+
exports.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = node.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE;
|
|
22
|
+
exports.Scope = node.Scope;
|
|
23
|
+
exports.addBreadcrumb = node.addBreadcrumb;
|
|
24
|
+
exports.addEventProcessor = node.addEventProcessor;
|
|
25
|
+
exports.addIntegration = node.addIntegration;
|
|
26
|
+
exports.addRequestDataToEvent = node.addRequestDataToEvent;
|
|
27
|
+
exports.anrIntegration = node.anrIntegration;
|
|
28
|
+
exports.captureCheckIn = node.captureCheckIn;
|
|
29
|
+
exports.captureEvent = node.captureEvent;
|
|
30
|
+
exports.captureException = node.captureException;
|
|
31
|
+
exports.captureMessage = node.captureMessage;
|
|
32
|
+
exports.captureSession = node.captureSession;
|
|
33
|
+
exports.close = node.close;
|
|
34
|
+
exports.consoleIntegration = node.consoleIntegration;
|
|
35
|
+
exports.contextLinesIntegration = node.contextLinesIntegration;
|
|
36
|
+
exports.continueTrace = node.continueTrace;
|
|
37
|
+
exports.createGetModuleFromFilename = node.createGetModuleFromFilename;
|
|
38
|
+
exports.createTransport = node.createTransport;
|
|
39
|
+
exports.cron = node.cron;
|
|
40
|
+
exports.defaultStackParser = node.defaultStackParser;
|
|
41
|
+
exports.endSession = node.endSession;
|
|
42
|
+
exports.expressErrorHandler = node.expressErrorHandler;
|
|
43
|
+
exports.expressIntegration = node.expressIntegration;
|
|
44
|
+
exports.extractRequestData = node.extractRequestData;
|
|
45
|
+
exports.fastifyIntegration = node.fastifyIntegration;
|
|
46
|
+
exports.flush = node.flush;
|
|
47
|
+
exports.functionToStringIntegration = node.functionToStringIntegration;
|
|
48
|
+
exports.getActiveSpan = node.getActiveSpan;
|
|
49
|
+
exports.getAutoPerformanceIntegrations = node.getAutoPerformanceIntegrations;
|
|
50
|
+
exports.getClient = node.getClient;
|
|
51
|
+
exports.getCurrentHub = node.getCurrentHub;
|
|
52
|
+
exports.getCurrentScope = node.getCurrentScope;
|
|
53
|
+
exports.getGlobalScope = node.getGlobalScope;
|
|
54
|
+
exports.getIsolationScope = node.getIsolationScope;
|
|
55
|
+
exports.getRootSpan = node.getRootSpan;
|
|
56
|
+
exports.getSentryRelease = node.getSentryRelease;
|
|
57
|
+
exports.getSpanDescendants = node.getSpanDescendants;
|
|
58
|
+
exports.getSpanStatusFromHttpCode = node.getSpanStatusFromHttpCode;
|
|
59
|
+
exports.graphqlIntegration = node.graphqlIntegration;
|
|
60
|
+
exports.hapiIntegration = node.hapiIntegration;
|
|
61
|
+
exports.httpIntegration = node.httpIntegration;
|
|
62
|
+
exports.inboundFiltersIntegration = node.inboundFiltersIntegration;
|
|
63
|
+
exports.isInitialized = node.isInitialized;
|
|
64
|
+
exports.linkedErrorsIntegration = node.linkedErrorsIntegration;
|
|
65
|
+
exports.localVariablesIntegration = node.localVariablesIntegration;
|
|
66
|
+
exports.makeNodeTransport = node.makeNodeTransport;
|
|
67
|
+
exports.metrics = node.metrics;
|
|
68
|
+
exports.modulesIntegration = node.modulesIntegration;
|
|
69
|
+
exports.mongoIntegration = node.mongoIntegration;
|
|
70
|
+
exports.mongooseIntegration = node.mongooseIntegration;
|
|
71
|
+
exports.mysql2Integration = node.mysql2Integration;
|
|
72
|
+
exports.mysqlIntegration = node.mysqlIntegration;
|
|
73
|
+
exports.nativeNodeFetchIntegration = node.nativeNodeFetchIntegration;
|
|
74
|
+
exports.nestIntegration = node.nestIntegration;
|
|
75
|
+
exports.nodeContextIntegration = node.nodeContextIntegration;
|
|
76
|
+
exports.onUncaughtExceptionIntegration = node.onUncaughtExceptionIntegration;
|
|
77
|
+
exports.onUnhandledRejectionIntegration = node.onUnhandledRejectionIntegration;
|
|
78
|
+
exports.parameterize = node.parameterize;
|
|
79
|
+
exports.postgresIntegration = node.postgresIntegration;
|
|
80
|
+
exports.prismaIntegration = node.prismaIntegration;
|
|
81
|
+
exports.requestDataIntegration = node.requestDataIntegration;
|
|
82
|
+
exports.setContext = node.setContext;
|
|
83
|
+
exports.setCurrentClient = node.setCurrentClient;
|
|
84
|
+
exports.setExtra = node.setExtra;
|
|
85
|
+
exports.setExtras = node.setExtras;
|
|
86
|
+
exports.setHttpStatus = node.setHttpStatus;
|
|
87
|
+
exports.setMeasurement = node.setMeasurement;
|
|
88
|
+
exports.setTag = node.setTag;
|
|
89
|
+
exports.setTags = node.setTags;
|
|
90
|
+
exports.setUser = node.setUser;
|
|
91
|
+
exports.setupExpressErrorHandler = node.setupExpressErrorHandler;
|
|
92
|
+
exports.setupHapiErrorHandler = node.setupHapiErrorHandler;
|
|
93
|
+
exports.spotlightIntegration = node.spotlightIntegration;
|
|
94
|
+
exports.startInactiveSpan = node.startInactiveSpan;
|
|
95
|
+
exports.startSession = node.startSession;
|
|
96
|
+
exports.startSpan = node.startSpan;
|
|
97
|
+
exports.startSpanManual = node.startSpanManual;
|
|
98
|
+
exports.withActiveSpan = node.withActiveSpan;
|
|
99
|
+
exports.withIsolationScope = node.withIsolationScope;
|
|
100
|
+
exports.withMonitor = node.withMonitor;
|
|
101
|
+
exports.withScope = node.withScope;
|
|
102
|
+
exports.captureConsoleIntegration = core.captureConsoleIntegration;
|
|
103
|
+
exports.debugIntegration = core.debugIntegration;
|
|
104
|
+
exports.dedupeIntegration = core.dedupeIntegration;
|
|
105
|
+
exports.extraErrorDataIntegration = core.extraErrorDataIntegration;
|
|
106
|
+
exports.rewriteFramesIntegration = core.rewriteFramesIntegration;
|
|
107
|
+
exports.sessionTimingIntegration = core.sessionTimingIntegration;
|
|
108
|
+
exports.getDefaultIntegrations = sdk.getDefaultIntegrations;
|
|
109
|
+
exports.init = sdk.init;
|
|
110
|
+
exports.googleCloudHttpIntegration = googleCloudHttp.googleCloudHttpIntegration;
|
|
111
|
+
exports.googleCloudGrpcIntegration = googleCloudGrpc.googleCloudGrpcIntegration;
|
|
112
|
+
exports.wrapCloudEventFunction = cloud_events.wrapCloudEventFunction;
|
|
113
|
+
exports.wrapHttpFunction = http.wrapHttpFunction;
|
|
114
|
+
exports.wrapEventFunction = events.wrapEventFunction;
|
|
115
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var {
|
|
2
|
+
_optionalChain
|
|
3
|
+
} = require('@sentry/utils');
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
|
+
|
|
7
|
+
const core = require('@sentry/core');
|
|
8
|
+
const node = require('@sentry/node');
|
|
9
|
+
const utils = require('@sentry/utils');
|
|
10
|
+
|
|
11
|
+
const SERVICE_PATH_REGEX = /^(\w+)\.googleapis.com$/;
|
|
12
|
+
|
|
13
|
+
const INTEGRATION_NAME = 'GoogleCloudGrpc';
|
|
14
|
+
|
|
15
|
+
const SETUP_CLIENTS = new WeakMap();
|
|
16
|
+
|
|
17
|
+
const _googleCloudGrpcIntegration = ((options = {}) => {
|
|
18
|
+
const optional = options.optional || false;
|
|
19
|
+
return {
|
|
20
|
+
name: INTEGRATION_NAME,
|
|
21
|
+
setupOnce() {
|
|
22
|
+
try {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
24
|
+
const gaxModule = require('google-gax');
|
|
25
|
+
utils.fill(
|
|
26
|
+
gaxModule.GrpcClient.prototype, // eslint-disable-line @typescript-eslint/no-unsafe-member-access
|
|
27
|
+
'createStub',
|
|
28
|
+
wrapCreateStub,
|
|
29
|
+
);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
if (!optional) {
|
|
32
|
+
throw e;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
setup(client) {
|
|
37
|
+
SETUP_CLIENTS.set(client, true);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}) ;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Google Cloud Platform service requests tracking for GRPC APIs.
|
|
44
|
+
*/
|
|
45
|
+
const googleCloudGrpcIntegration = core.defineIntegration(_googleCloudGrpcIntegration);
|
|
46
|
+
|
|
47
|
+
/** Returns a wrapped function that returns a stub with tracing enabled */
|
|
48
|
+
function wrapCreateStub(origCreate) {
|
|
49
|
+
return async function ( ...args) {
|
|
50
|
+
const servicePath = _optionalChain([args, 'access', _ => _[1], 'optionalAccess', _2 => _2.servicePath]);
|
|
51
|
+
if (servicePath == null || servicePath == undefined) {
|
|
52
|
+
return origCreate.apply(this, args);
|
|
53
|
+
}
|
|
54
|
+
const serviceIdentifier = identifyService(servicePath);
|
|
55
|
+
const stub = await origCreate.apply(this, args);
|
|
56
|
+
for (const methodName of Object.keys(Object.getPrototypeOf(stub))) {
|
|
57
|
+
fillGrpcFunction(stub, serviceIdentifier, methodName);
|
|
58
|
+
}
|
|
59
|
+
return stub;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Patches the function in grpc stub to enable tracing */
|
|
64
|
+
function fillGrpcFunction(stub, serviceIdentifier, methodName) {
|
|
65
|
+
const funcObj = stub[methodName];
|
|
66
|
+
if (typeof funcObj !== 'function') {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const callType =
|
|
70
|
+
!funcObj.requestStream && !funcObj.responseStream
|
|
71
|
+
? 'unary call'
|
|
72
|
+
: funcObj.requestStream && !funcObj.responseStream
|
|
73
|
+
? 'client stream'
|
|
74
|
+
: !funcObj.requestStream && funcObj.responseStream
|
|
75
|
+
? 'server stream'
|
|
76
|
+
: 'bidi stream';
|
|
77
|
+
if (callType != 'unary call') {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
utils.fill(
|
|
81
|
+
stub,
|
|
82
|
+
methodName,
|
|
83
|
+
(orig) =>
|
|
84
|
+
(...args) => {
|
|
85
|
+
const ret = orig.apply(stub, args);
|
|
86
|
+
if (typeof _optionalChain([ret, 'optionalAccess', _3 => _3.on]) !== 'function' || !SETUP_CLIENTS.has(core.getClient() )) {
|
|
87
|
+
return ret;
|
|
88
|
+
}
|
|
89
|
+
const span = node.startInactiveSpan({
|
|
90
|
+
name: `${callType} ${methodName}`,
|
|
91
|
+
onlyIfParent: true,
|
|
92
|
+
op: `grpc.${serviceIdentifier}`,
|
|
93
|
+
attributes: {
|
|
94
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
ret.on('status', () => {
|
|
98
|
+
if (span) {
|
|
99
|
+
span.end();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return ret;
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Identifies service by its address */
|
|
108
|
+
function identifyService(servicePath) {
|
|
109
|
+
const match = servicePath.match(SERVICE_PATH_REGEX);
|
|
110
|
+
return match ? match[1] : servicePath;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exports.googleCloudGrpcIntegration = googleCloudGrpcIntegration;
|
|
114
|
+
//# sourceMappingURL=google-cloud-grpc.js.map
|