@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.
Files changed (70) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +47 -0
  3. package/cjs/debug-build.js +11 -0
  4. package/cjs/debug-build.js.map +1 -0
  5. package/cjs/gcpfunction/cloud_events.js +82 -0
  6. package/cjs/gcpfunction/cloud_events.js.map +1 -0
  7. package/cjs/gcpfunction/events.js +87 -0
  8. package/cjs/gcpfunction/events.js.map +1 -0
  9. package/cjs/gcpfunction/http.js +98 -0
  10. package/cjs/gcpfunction/http.js.map +1 -0
  11. package/cjs/index.js +115 -0
  12. package/cjs/index.js.map +1 -0
  13. package/cjs/integrations/google-cloud-grpc.js +114 -0
  14. package/cjs/integrations/google-cloud-grpc.js.map +1 -0
  15. package/cjs/integrations/google-cloud-http.js +65 -0
  16. package/cjs/integrations/google-cloud-http.js.map +1 -0
  17. package/cjs/sdk.js +42 -0
  18. package/cjs/sdk.js.map +1 -0
  19. package/cjs/utils.js +60 -0
  20. package/cjs/utils.js.map +1 -0
  21. package/esm/debug-build.js +9 -0
  22. package/esm/debug-build.js.map +1 -0
  23. package/esm/gcpfunction/cloud_events.js +80 -0
  24. package/esm/gcpfunction/cloud_events.js.map +1 -0
  25. package/esm/gcpfunction/events.js +85 -0
  26. package/esm/gcpfunction/events.js.map +1 -0
  27. package/esm/gcpfunction/http.js +93 -0
  28. package/esm/gcpfunction/http.js.map +1 -0
  29. package/esm/index.js +9 -0
  30. package/esm/index.js.map +1 -0
  31. package/esm/integrations/google-cloud-grpc.js +109 -0
  32. package/esm/integrations/google-cloud-grpc.js.map +1 -0
  33. package/esm/integrations/google-cloud-http.js +63 -0
  34. package/esm/integrations/google-cloud-http.js.map +1 -0
  35. package/esm/package.json +1 -0
  36. package/esm/sdk.js +39 -0
  37. package/esm/sdk.js.map +1 -0
  38. package/esm/utils.js +56 -0
  39. package/esm/utils.js.map +1 -0
  40. package/package.json +58 -0
  41. package/types/debug-build.d.ts +7 -0
  42. package/types/debug-build.d.ts.map +1 -0
  43. package/types/gcpfunction/cloud_events.d.ts +11 -0
  44. package/types/gcpfunction/cloud_events.d.ts.map +1 -0
  45. package/types/gcpfunction/events.d.ts +11 -0
  46. package/types/gcpfunction/events.d.ts.map +1 -0
  47. package/types/gcpfunction/general.d.ts +38 -0
  48. package/types/gcpfunction/general.d.ts.map +1 -0
  49. package/types/gcpfunction/http.d.ts +10 -0
  50. package/types/gcpfunction/http.d.ts.map +1 -0
  51. package/types/index.d.ts +9 -0
  52. package/types/index.d.ts.map +1 -0
  53. package/types/integrations/google-cloud-grpc.d.ts +7 -0
  54. package/types/integrations/google-cloud-grpc.d.ts.map +1 -0
  55. package/types/integrations/google-cloud-http.d.ts +7 -0
  56. package/types/integrations/google-cloud-http.d.ts.map +1 -0
  57. package/types/sdk.d.ts +9 -0
  58. package/types/sdk.d.ts.map +1 -0
  59. package/types/utils.d.ts +18 -0
  60. package/types/utils.d.ts.map +1 -0
  61. package/types-ts3.8/debug-build.d.ts +7 -0
  62. package/types-ts3.8/gcpfunction/cloud_events.d.ts +11 -0
  63. package/types-ts3.8/gcpfunction/events.d.ts +11 -0
  64. package/types-ts3.8/gcpfunction/general.d.ts +38 -0
  65. package/types-ts3.8/gcpfunction/http.d.ts +10 -0
  66. package/types-ts3.8/index.d.ts +9 -0
  67. package/types-ts3.8/integrations/google-cloud-grpc.d.ts +7 -0
  68. package/types-ts3.8/integrations/google-cloud-http.d.ts +7 -0
  69. package/types-ts3.8/sdk.d.ts +9 -0
  70. package/types-ts3.8/utils.d.ts +18 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import type { EventEmitter } from 'events';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, getClient } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { Client, IntegrationFn } from '@sentry/types';\nimport { fill } from '@sentry/utils';\n\ninterface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\ninterface GrpcFunctionObject extends GrpcFunction {\n requestStream: boolean;\n responseStream: boolean;\n originalName: string;\n}\n\ninterface StubOptions {\n servicePath?: string;\n}\n\ninterface CreateStubFunc extends CallableFunction {\n (createStub: unknown, options: StubOptions): PromiseLike<Stub>;\n}\n\ninterface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc';\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudGrpcIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const gaxModule = require('google-gax');\n fill(\n gaxModule.GrpcClient.prototype, // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n 'createStub',\n wrapCreateStub,\n );\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for GRPC APIs.\n */\nexport const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);\n\n/** Returns a wrapped function that returns a stub with tracing enabled */\nfunction wrapCreateStub(origCreate: CreateStubFunc): CreateStubFunc {\n return async function (this: unknown, ...args: Parameters<CreateStubFunc>) {\n const servicePath = args[1]?.servicePath;\n if (servicePath == null || servicePath == undefined) {\n return origCreate.apply(this, args);\n }\n const serviceIdentifier = identifyService(servicePath);\n const stub = await origCreate.apply(this, args);\n for (const methodName of Object.keys(Object.getPrototypeOf(stub))) {\n fillGrpcFunction(stub, serviceIdentifier, methodName);\n }\n return stub;\n };\n}\n\n/** Patches the function in grpc stub to enable tracing */\nfunction fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void {\n const funcObj = stub[methodName];\n if (typeof funcObj !== 'function') {\n return;\n }\n const callType =\n !funcObj.requestStream && !funcObj.responseStream\n ? 'unary call'\n : funcObj.requestStream && !funcObj.responseStream\n ? 'client stream'\n : !funcObj.requestStream && funcObj.responseStream\n ? 'server stream'\n : 'bidi stream';\n if (callType != 'unary call') {\n return;\n }\n fill(\n stub,\n methodName,\n (orig: GrpcFunction): GrpcFunction =>\n (...args) => {\n const ret = orig.apply(stub, args);\n if (typeof ret?.on !== 'function' || !SETUP_CLIENTS.has(getClient() as Client)) {\n return ret;\n }\n const span = startInactiveSpan({\n name: `${callType} ${methodName}`,\n onlyIfParent: true,\n op: `grpc.${serviceIdentifier}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',\n },\n });\n ret.on('status', () => {\n if (span) {\n span.end();\n }\n });\n return ret;\n },\n );\n}\n\n/** Identifies service by its address */\nfunction identifyService(servicePath: string): string {\n const match = servicePath.match(SERVICE_PATH_REGEX);\n return match ? match[1] : servicePath;\n}\n"],"names":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;;;;;;AA4BA,CAAM,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAqB,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB;;AAEpD,CAAM,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;EACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,MAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA;;"}
@@ -0,0 +1,65 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ const core = require('@sentry/core');
4
+ const node = require('@sentry/node');
5
+ const utils = require('@sentry/utils');
6
+
7
+ const INTEGRATION_NAME = 'GoogleCloudHttp';
8
+
9
+ const SETUP_CLIENTS = new WeakMap();
10
+
11
+ const _googleCloudHttpIntegration = ((options = {}) => {
12
+ const optional = options.optional || false;
13
+ return {
14
+ name: INTEGRATION_NAME,
15
+ setupOnce() {
16
+ try {
17
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
18
+ const commonModule = require('@google-cloud/common') ;
19
+ utils.fill(commonModule.Service.prototype, 'request', wrapRequestFunction);
20
+ } catch (e) {
21
+ if (!optional) {
22
+ throw e;
23
+ }
24
+ }
25
+ },
26
+ setup(client) {
27
+ SETUP_CLIENTS.set(client, true);
28
+ },
29
+ };
30
+ }) ;
31
+
32
+ /**
33
+ * Google Cloud Platform service requests tracking for RESTful APIs.
34
+ */
35
+ const googleCloudHttpIntegration = core.defineIntegration(_googleCloudHttpIntegration);
36
+
37
+ /** Returns a wrapped function that makes a request with tracing enabled */
38
+ function wrapRequestFunction(orig) {
39
+ return function ( reqOpts, callback) {
40
+ const httpMethod = reqOpts.method || 'GET';
41
+ const span = SETUP_CLIENTS.has(core.getClient() )
42
+ ? node.startInactiveSpan({
43
+ name: `${httpMethod} ${reqOpts.uri}`,
44
+ onlyIfParent: true,
45
+ op: `http.client.${identifyService(this.apiEndpoint)}`,
46
+ attributes: {
47
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',
48
+ },
49
+ })
50
+ : new core.SentryNonRecordingSpan();
51
+ orig.call(this, reqOpts, (...args) => {
52
+ span.end();
53
+ callback(...args);
54
+ });
55
+ };
56
+ }
57
+
58
+ /** Identifies service by its base url */
59
+ function identifyService(apiEndpoint) {
60
+ const match = apiEndpoint.match(/^https:\/\/(\w+)\.googleapis.com$/);
61
+ return match ? match[1] : apiEndpoint.replace(/^(http|https)?:\/\//, '');
62
+ }
63
+
64
+ exports.googleCloudHttpIntegration = googleCloudHttpIntegration;
65
+ //# sourceMappingURL=google-cloud-http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-cloud-http.js","sources":["../../../src/integrations/google-cloud-http.ts"],"sourcesContent":["import type * as common from '@google-cloud/common';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, defineIntegration, getClient } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { Client, IntegrationFn } from '@sentry/types';\nimport { fill } from '@sentry/utils';\n\ntype RequestOptions = common.DecorateRequestOptions;\ntype ResponseCallback = common.BodyResponseCallback;\n// This interace could be replaced with just type alias once the `strictBindCallApply` mode is enabled.\ninterface RequestFunction extends CallableFunction {\n (reqOpts: RequestOptions, callback: ResponseCallback): void;\n}\n\nconst INTEGRATION_NAME = 'GoogleCloudHttp';\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudHttpIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const commonModule = require('@google-cloud/common') as typeof common;\n fill(commonModule.Service.prototype, 'request', wrapRequestFunction);\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for RESTful APIs.\n */\nexport const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);\n\n/** Returns a wrapped function that makes a request with tracing enabled */\nfunction wrapRequestFunction(orig: RequestFunction): RequestFunction {\n return function (this: common.Service, reqOpts: RequestOptions, callback: ResponseCallback): void {\n const httpMethod = reqOpts.method || 'GET';\n const span = SETUP_CLIENTS.has(getClient() as Client)\n ? startInactiveSpan({\n name: `${httpMethod} ${reqOpts.uri}`,\n onlyIfParent: true,\n op: `http.client.${identifyService(this.apiEndpoint)}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n },\n })\n : new SentryNonRecordingSpan();\n orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {\n span.end();\n callback(...args);\n });\n };\n}\n\n/** Identifies service by its base url */\nfunction identifyService(apiEndpoint: string): string {\n const match = apiEndpoint.match(/^https:\\/\\/(\\w+)\\.googleapis.com$/);\n return match ? match[1] : apiEndpoint.replace(/^(http|https)?:\\/\\//, '');\n}\n"],"names":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SentryNonRecordingSpan"],"mappings":";;;;;;AAaA,MAAM,gBAAA,GAAmB,iBAAiB,CAAA;AAC1C;AACA,MAAM,aAAc,GAAE,IAAI,OAAO,EAAmB,CAAA;AACpD;AACA,MAAM,2BAAA,IAA+B,CAAC,OAAO,GAA2B,EAAE,KAAK;AAC/E,EAAE,MAAM,QAAS,GAAE,OAAO,CAAC,QAAA,IAAY,KAAK,CAAA;AAC5C,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,IAAI;AACV;AACA,QAAQ,MAAM,YAAa,GAAE,OAAO,CAAC,sBAAsB,CAAE,EAAA;AAC7D,QAAQA,UAAI,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAA;AAC5E,OAAQ,CAAA,OAAO,CAAC,EAA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A,KAAA,CAAA,mCAAA,CAAA,CAAA;AACA,EAAA,OAAA,KAAA,GAAA,KAAA,CAAA,CAAA,CAAA,GAAA,WAAA,CAAA,OAAA,CAAA,qBAAA,EAAA,EAAA,CAAA,CAAA;AACA;;;;"}
package/cjs/sdk.js ADDED
@@ -0,0 +1,42 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ const node = require('@sentry/node');
4
+ const googleCloudGrpc = require('./integrations/google-cloud-grpc.js');
5
+ const googleCloudHttp = require('./integrations/google-cloud-http.js');
6
+
7
+ /** Get the default integrations for the GCP SDK. */
8
+ function getDefaultIntegrations(options) {
9
+ return [
10
+ ...node.getDefaultIntegrations(options),
11
+ googleCloudHttp.googleCloudHttpIntegration({ optional: true }), // We mark this integration optional since '@google-cloud/common' module could be missing.
12
+ googleCloudGrpc.googleCloudGrpcIntegration({ optional: true }), // We mark this integration optional since 'google-gax' module could be missing.
13
+ ];
14
+ }
15
+
16
+ /**
17
+ * @see {@link Sentry.init}
18
+ */
19
+ function init(options = {}) {
20
+ const opts = {
21
+ _metadata: {} ,
22
+ defaultIntegrations: getDefaultIntegrations(options),
23
+ ...options,
24
+ };
25
+
26
+ opts._metadata.sdk = opts._metadata.sdk || {
27
+ name: 'sentry.javascript.google-cloud-serverless',
28
+ packages: [
29
+ {
30
+ name: 'npm:@sentry/google-cloud-serverless',
31
+ version: node.SDK_VERSION,
32
+ },
33
+ ],
34
+ version: node.SDK_VERSION,
35
+ };
36
+
37
+ node.init(opts);
38
+ }
39
+
40
+ exports.getDefaultIntegrations = getDefaultIntegrations;
41
+ exports.init = init;
42
+ //# sourceMappingURL=sdk.js.map
package/cjs/sdk.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { NodeOptions } from '@sentry/node';\nimport { SDK_VERSION, getDefaultIntegrations as getDefaultNodeIntegrations, init as initNode } from '@sentry/node';\nimport type { Integration, Options, SdkMetadata } from '@sentry/types';\n\nimport { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';\nimport { googleCloudHttpIntegration } from './integrations/google-cloud-http';\n\n/** Get the default integrations for the GCP SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n return [\n ...getDefaultNodeIntegrations(options),\n googleCloudHttpIntegration({ optional: true }), // We mark this integration optional since '@google-cloud/common' module could be missing.\n googleCloudGrpcIntegration({ optional: true }), // We mark this integration optional since 'google-gax' module could be missing.\n ];\n}\n\n/**\n * @see {@link Sentry.init}\n */\nexport function init(options: NodeOptions = {}): void {\n const opts = {\n _metadata: {} as SdkMetadata,\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n opts._metadata.sdk = opts._metadata.sdk || {\n name: 'sentry.javascript.google-cloud-serverless',\n packages: [\n {\n name: 'npm:@sentry/google-cloud-serverless',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n\n initNode(opts);\n}\n"],"names":["getDefaultNodeIntegrations","googleCloudHttpIntegration","googleCloudGrpcIntegration","SDK_VERSION","initNode"],"mappings":";;;;;;AAOA;AACO,SAAS,sBAAsB,CAAC,OAAO,EAA0B;AACxE,EAAE,OAAO;AACT,IAAI,GAAGA,2BAA0B,CAAC,OAAO,CAAC;AAC1C,IAAIC,0CAA0B,CAAC,EAAE,QAAQ,EAAE,IAAA,EAAM,CAAC;AAClD,IAAIC,0CAA0B,CAAC,EAAE,QAAQ,EAAE,IAAA,EAAM,CAAC;AAClD,GAAG,CAAA;AACH,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,GAAgB,EAAE,EAAQ;AACtD,EAAE,MAAM,OAAO;AACf,IAAI,SAAS,EAAE,EAAG;AAClB,IAAI,mBAAmB,EAAE,sBAAsB,CAAC,OAAO,CAAC;AACxD,IAAI,GAAG,OAAO;AACd,GAAG,CAAA;AACH;AACA,EAAE,IAAI,CAAC,SAAS,CAAC,GAAA,GAAM,IAAI,CAAC,SAAS,CAAC,GAAA,IAAO;AAC7C,IAAI,IAAI,EAAE,2CAA2C;AACrD,IAAI,QAAQ,EAAE;AACd,MAAM;AACN,QAAQ,IAAI,EAAE,qCAAqC;AACnD,QAAQ,OAAO,EAAEC,gBAAW;AAC5B,OAAO;AACP,KAAK;AACL,IAAI,OAAO,EAAEA,gBAAW;AACxB,GAAG,CAAA;AACH;AACA,EAAEC,SAAQ,CAAC,IAAI,CAAC,CAAA;AAChB;;;;;"}
package/cjs/utils.js ADDED
@@ -0,0 +1,60 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ const core = require('@sentry/core');
4
+ const utils = require('@sentry/utils');
5
+
6
+ /**
7
+ * @param fn function to run
8
+ * @returns function which runs in the newly created domain or in the existing one
9
+ */
10
+ function domainify(fn) {
11
+ return (...args) => core.withIsolationScope(() => fn(...args));
12
+ }
13
+
14
+ /**
15
+ * @param source function to be wrapped
16
+ * @param wrap wrapping function that takes source and returns a wrapper
17
+ * @param overrides properties to override in the source
18
+ * @returns wrapped function
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ function proxyFunction(
22
+ source,
23
+ wrap,
24
+ overrides,
25
+ ) {
26
+ const wrapper = wrap(source);
27
+ const handler = {
28
+ apply: (_target, thisArg, args) => {
29
+ return wrapper.apply(thisArg, args);
30
+ },
31
+ };
32
+
33
+ if (overrides) {
34
+ handler.get = (target, prop) => {
35
+ if (Object.prototype.hasOwnProperty.call(overrides, prop)) {
36
+ return overrides[prop ];
37
+ }
38
+ return (target )[prop ];
39
+ };
40
+ }
41
+
42
+ return new Proxy(source, handler);
43
+ }
44
+
45
+ /**
46
+ * Marks an event as unhandled by adding a span processor to the passed scope.
47
+ */
48
+ function markEventUnhandled(scope) {
49
+ scope.addEventProcessor(event => {
50
+ utils.addExceptionMechanism(event, { handled: false });
51
+ return event;
52
+ });
53
+
54
+ return scope;
55
+ }
56
+
57
+ exports.domainify = domainify;
58
+ exports.markEventUnhandled = markEventUnhandled;
59
+ exports.proxyFunction = proxyFunction;
60
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import { withIsolationScope } from '@sentry/core';\nimport type { Scope } from '@sentry/types';\nimport { addExceptionMechanism } from '@sentry/utils';\n\n/**\n * @param fn function to run\n * @returns function which runs in the newly created domain or in the existing one\n */\nexport function domainify<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R | void {\n return (...args) => withIsolationScope(() => fn(...args));\n}\n\n/**\n * @param source function to be wrapped\n * @param wrap wrapping function that takes source and returns a wrapper\n * @param overrides properties to override in the source\n * @returns wrapped function\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function proxyFunction<A extends any[], R, F extends (...args: A) => R>(\n source: F,\n wrap: (source: F) => F,\n overrides?: Record<PropertyKey, unknown>,\n): F {\n const wrapper = wrap(source);\n const handler: ProxyHandler<F> = {\n apply: <T>(_target: F, thisArg: T, args: A) => {\n return wrapper.apply(thisArg, args);\n },\n };\n\n if (overrides) {\n handler.get = (target, prop) => {\n if (Object.prototype.hasOwnProperty.call(overrides, prop)) {\n return overrides[prop as string];\n }\n return (target as Record<PropertyKey, unknown>)[prop as string];\n };\n }\n\n return new Proxy(source, handler);\n}\n\n/**\n * Marks an event as unhandled by adding a span processor to the passed scope.\n */\nexport function markEventUnhandled(scope: Scope): Scope {\n scope.addEventProcessor(event => {\n addExceptionMechanism(event, { handled: false });\n return event;\n });\n\n return scope;\n}\n"],"names":["withIsolationScope","addExceptionMechanism"],"mappings":";;;;;AAIA;AACA;AACA;AACA;AACO,SAAS,SAAS,CAAyB,EAAE,EAA+C;AACnG,EAAE,OAAO,CAAC,GAAG,IAAI,KAAKA,uBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;AAC3D,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa;AAC7B,EAAE,MAAM;AACR,EAAE,IAAI;AACN,EAAE,SAAS;AACX,EAAK;AACL,EAAE,MAAM,OAAQ,GAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AAC9B,EAAE,MAAM,OAAO,GAAoB;AACnC,IAAI,KAAK,EAAE,CAAI,OAAO,EAAK,OAAO,EAAK,IAAI,KAAQ;AACnD,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACzC,KAAK;AACL,GAAG,CAAA;AACH;AACA,EAAE,IAAI,SAAS,EAAE;AACjB,IAAI,OAAO,CAAC,GAAI,GAAE,CAAC,MAAM,EAAE,IAAI,KAAK;AACpC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;AACjE,QAAQ,OAAO,SAAS,CAAC,IAAA,EAAe,CAAA;AACxC,OAAM;AACN,MAAM,OAAO,CAAC,MAAA,GAAwC,MAAe,CAAA;AACrE,KAAK,CAAA;AACL,GAAE;AACF;AACA,EAAE,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACnC,CAAA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,KAAK,EAAgB;AACxD,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS;AACnC,IAAIC,2BAAqB,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,KAAM,EAAC,CAAC,CAAA;AACpD,IAAI,OAAO,KAAK,CAAA;AAChB,GAAG,CAAC,CAAA;AACJ;AACA,EAAE,OAAO,KAAK,CAAA;AACd;;;;;;"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 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.
3
+ *
4
+ * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
5
+ */
6
+ const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
7
+
8
+ export { DEBUG_BUILD };
9
+ //# 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,80 @@
1
+ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, handleCallbackErrors } from '@sentry/core';
2
+ import { startSpanManual, getCurrentScope, captureException, flush } from '@sentry/node';
3
+ import { logger } from '@sentry/utils';
4
+ import { DEBUG_BUILD } from '../debug-build.js';
5
+ import { proxyFunction, domainify, markEventUnhandled } from '../utils.js';
6
+
7
+ /**
8
+ * Wraps an event function handler adding it error capture and tracing capabilities.
9
+ *
10
+ * @param fn Event handler
11
+ * @param options Options
12
+ * @returns Event handler
13
+ */
14
+ function wrapCloudEventFunction(
15
+ fn,
16
+ wrapOptions = {},
17
+ ) {
18
+ return proxyFunction(fn, f => domainify(_wrapCloudEventFunction(f, wrapOptions)));
19
+ }
20
+
21
+ function _wrapCloudEventFunction(
22
+ fn,
23
+ wrapOptions = {},
24
+ ) {
25
+ const options = {
26
+ flushTimeout: 2000,
27
+ ...wrapOptions,
28
+ };
29
+ return (context, callback) => {
30
+ return startSpanManual(
31
+ {
32
+ name: context.type || '<unknown>',
33
+ op: 'function.gcp.cloud_event',
34
+ attributes: {
35
+ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
36
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event',
37
+ },
38
+ },
39
+ span => {
40
+ const scope = getCurrentScope();
41
+ scope.setContext('gcp.function.context', { ...context });
42
+
43
+ const newCallback = domainify((...args) => {
44
+ if (args[0] !== null && args[0] !== undefined) {
45
+ captureException(args[0], scope => markEventUnhandled(scope));
46
+ }
47
+ span.end();
48
+
49
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
50
+ flush(options.flushTimeout)
51
+ .then(null, e => {
52
+ DEBUG_BUILD && logger.error(e);
53
+ })
54
+ .then(() => {
55
+ callback(...args);
56
+ });
57
+ });
58
+
59
+ if (fn.length > 1) {
60
+ return handleCallbackErrors(
61
+ () => (fn )(context, newCallback),
62
+ err => {
63
+ captureException(err, scope => markEventUnhandled(scope));
64
+ },
65
+ );
66
+ }
67
+
68
+ return Promise.resolve()
69
+ .then(() => (fn )(context))
70
+ .then(
71
+ result => newCallback(null, result),
72
+ err => newCallback(err, undefined),
73
+ );
74
+ },
75
+ );
76
+ };
77
+ }
78
+
79
+ export { wrapCloudEventFunction };
80
+ //# 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":[],"mappings":";;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB;AACtC,EAAE,EAAE;AACJ,EAAE,WAAW,GAA8C,EAAE;AAC7D,EAAkC;AAClC,EAAE,OAAO,aAAa,CAAC,EAAE,EAAE,KAAK,SAAS,CAAC,uBAAuB,CAAC,CAAC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,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,OAAO,oBAAoB;AACrC,YAAY,MAAM,CAAC,EAAA,GAAsC,OAAO,EAAE,WAAW,CAAC;AAC9E,YAAY,OAAO;AACnB,cAAc,gBAAgB,CAAC,GAAG,EAAE,KAAA,IAAS,kBAAkB,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,85 @@
1
+ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, handleCallbackErrors } from '@sentry/core';
2
+ import { startSpanManual, getCurrentScope, captureException, flush } from '@sentry/node';
3
+ import { logger } from '@sentry/utils';
4
+ import { DEBUG_BUILD } from '../debug-build.js';
5
+ import { proxyFunction, domainify, markEventUnhandled } from '../utils.js';
6
+
7
+ /**
8
+ * Wraps an event function handler adding it error capture and tracing capabilities.
9
+ *
10
+ * @param fn Event handler
11
+ * @param options Options
12
+ * @returns Event handler
13
+ */
14
+ function wrapEventFunction(
15
+ fn,
16
+ wrapOptions = {},
17
+ ) {
18
+ return proxyFunction(fn, f => domainify(_wrapEventFunction(f, wrapOptions)));
19
+ }
20
+
21
+ /** */
22
+ function _wrapEventFunction(
23
+ fn,
24
+ wrapOptions = {},
25
+ ) {
26
+ const options = {
27
+ flushTimeout: 2000,
28
+ ...wrapOptions,
29
+ };
30
+ return (...eventFunctionArguments) => {
31
+ const [data, context, callback] = eventFunctionArguments;
32
+
33
+ return startSpanManual(
34
+ {
35
+ name: context.eventType,
36
+ op: 'function.gcp.event',
37
+ attributes: {
38
+ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
39
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_event',
40
+ },
41
+ },
42
+ span => {
43
+ const scope = getCurrentScope();
44
+ scope.setContext('gcp.function.context', { ...context });
45
+
46
+ const newCallback = domainify((...args) => {
47
+ if (args[0] !== null && args[0] !== undefined) {
48
+ captureException(args[0], scope => markEventUnhandled(scope));
49
+ }
50
+ span.end();
51
+
52
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
53
+ flush(options.flushTimeout)
54
+ .then(null, e => {
55
+ DEBUG_BUILD && logger.error(e);
56
+ })
57
+ .then(() => {
58
+ if (typeof callback === 'function') {
59
+ callback(...args);
60
+ }
61
+ });
62
+ });
63
+
64
+ if (fn.length > 2) {
65
+ return handleCallbackErrors(
66
+ () => (fn )(data, context, newCallback),
67
+ err => {
68
+ captureException(err, scope => markEventUnhandled(scope));
69
+ },
70
+ );
71
+ }
72
+
73
+ return Promise.resolve()
74
+ .then(() => (fn )(data, context))
75
+ .then(
76
+ result => newCallback(null, result),
77
+ err => newCallback(err, undefined),
78
+ );
79
+ },
80
+ );
81
+ };
82
+ }
83
+
84
+ export { wrapEventFunction };
85
+ //# 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":[],"mappings":";;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB;AACjC,EAAE,EAAE;AACJ,EAAE,WAAW,GAAyC,EAAE;AACxD,EAA6B;AAC7B,EAAE,OAAO,aAAa,CAAC,EAAE,EAAE,KAAK,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;AAC9E,CAAA;AACA;AACA;AACA,SAAS,kBAAkB;AAC3B,EAAE,EAAE;AACJ,EAAE,WAAW,GAAyC,EAAE;AACxD,EAA6D;AAC7D,EAAE,MAAM,OAAO,GAAgC;AAC/C,IAAI,YAAY,EAAE,IAAI;AACtB,IAAI,GAAG,WAAW;AAClB,GAAG,CAAA;AACH,EAAE,OAAO,CAAC,GAAG,sBAAsB,KAAmD;AACtF,IAAI,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAE,GAAE,sBAAsB,CAAA;AAC5D;AACA,IAAI,OAAO,eAAe;AAC1B,MAAM;AACN,QAAQ,IAAI,EAAE,OAAO,CAAC,SAAS;AAC/B,QAAQ,EAAE,EAAE,oBAAoB;AAChC,QAAQ,UAAU,EAAE;AACpB,UAAU,CAAC,gCAAgC,GAAG,WAAW;AACzD,UAAU,CAAC,gCAAgC,GAAG,oCAAoC;AAClF,SAAS;AACT,OAAO;AACP,MAAM,QAAQ;AACd,QAAQ,MAAM,KAAA,GAAQ,eAAe,EAAE,CAAA;AACvC,QAAQ,KAAK,CAAC,UAAU,CAAC,sBAAsB,EAAE,EAAE,GAAG,OAAQ,EAAC,CAAC,CAAA;AAChE;AACA,QAAQ,MAAM,cAAc,SAAS,CAAC,CAAC,GAAG,IAAI,KAAgB;AAC9D,UAAU,IAAI,IAAI,CAAC,CAAC,C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@@ -0,0 +1,93 @@
1
+ import { _optionalChain } from '@sentry/utils';
2
+ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, Transaction, setHttpStatus, handleCallbackErrors } from '@sentry/core';
3
+ import { continueTrace, startSpanManual, getCurrentScope, flush, captureException } from '@sentry/node';
4
+ import { stripUrlQueryAndFragment, isString, logger } from '@sentry/utils';
5
+ import { DEBUG_BUILD } from '../debug-build.js';
6
+ import { proxyFunction, domainify, markEventUnhandled } from '../utils.js';
7
+
8
+ /**
9
+ * Wraps an HTTP function handler adding it error capture and tracing capabilities.
10
+ *
11
+ * @param fn HTTP Handler
12
+ * @param options Options
13
+ * @returns HTTP handler
14
+ */
15
+ function wrapHttpFunction(fn, wrapOptions = {}) {
16
+ const wrap = (f) => domainify(_wrapHttpFunction(f, wrapOptions));
17
+
18
+ let overrides;
19
+
20
+ // Functions emulator from firebase-tools has a hack-ish workaround that saves the actual function
21
+ // passed to `onRequest(...)` and in fact runs it so we need to wrap it too.
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
23
+ const emulatorFunc = (fn ).__emulator_func ;
24
+ if (emulatorFunc) {
25
+ overrides = { __emulator_func: proxyFunction(emulatorFunc, wrap) };
26
+ }
27
+ return proxyFunction(fn, wrap, overrides);
28
+ }
29
+
30
+ /** */
31
+ function _wrapHttpFunction(fn, options) {
32
+ const flushTimeout = options.flushTimeout || 2000;
33
+ return (req, res) => {
34
+ const reqMethod = (req.method || '').toUpperCase();
35
+ const reqUrl = stripUrlQueryAndFragment(req.originalUrl || req.url || '');
36
+
37
+ const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;
38
+ const baggage = _optionalChain([req, 'access', _ => _.headers, 'optionalAccess', _2 => _2.baggage]);
39
+
40
+ return continueTrace({ sentryTrace, baggage }, () => {
41
+ return startSpanManual(
42
+ {
43
+ name: `${reqMethod} ${reqUrl}`,
44
+ op: 'function.gcp.http',
45
+ attributes: {
46
+ [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
47
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',
48
+ },
49
+ },
50
+ span => {
51
+ getCurrentScope().setSDKProcessingMetadata({
52
+ request: req,
53
+ });
54
+
55
+ if (span instanceof Transaction) {
56
+ // We also set __sentry_transaction on the response so people can grab the transaction there to add
57
+ // spans to it later.
58
+ // TODO(v8): Remove this
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
60
+ (res ).__sentry_transaction = span;
61
+ }
62
+
63
+ // eslint-disable-next-line @typescript-eslint/unbound-method
64
+ const _end = res.end;
65
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
+ res.end = function (chunk, encoding, cb) {
67
+ setHttpStatus(span, res.statusCode);
68
+ span.end();
69
+
70
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
71
+ flush(flushTimeout)
72
+ .then(null, e => {
73
+ DEBUG_BUILD && logger.error(e);
74
+ })
75
+ .then(() => {
76
+ _end.call(this, chunk, encoding, cb);
77
+ });
78
+ };
79
+
80
+ return handleCallbackErrors(
81
+ () => fn(req, res),
82
+ err => {
83
+ captureException(err, scope => markEventUnhandled(scope));
84
+ },
85
+ );
86
+ },
87
+ );
88
+ });
89
+ };
90
+ }
91
+
92
+ export { wrapHttpFunction };
93
+ //# 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":[],"mappings":";;;;;;;AAcA,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;CACA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;YACA,CAAA;UACA,CAAA;QACA,CAAA;MACA,CAAA;IACA,CAAA,CAAA;EACA,CAAA;AACA;;"}
package/esm/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export { DEFAULT_USER_INCLUDES, Hub, NodeClient, SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, addRequestDataToEvent, anrIntegration, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, consoleIntegration, contextLinesIntegration, continueTrace, createGetModuleFromFilename, createTransport, cron, defaultStackParser, endSession, expressErrorHandler, expressIntegration, extractRequestData, fastifyIntegration, flush, functionToStringIntegration, getActiveSpan, getAutoPerformanceIntegrations, getClient, getCurrentHub, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, getSentryRelease, getSpanDescendants, getSpanStatusFromHttpCode, graphqlIntegration, hapiIntegration, httpIntegration, inboundFiltersIntegration, isInitialized, linkedErrorsIntegration, localVariablesIntegration, makeNodeTransport, metrics, modulesIntegration, mongoIntegration, mongooseIntegration, mysql2Integration, mysqlIntegration, nativeNodeFetchIntegration, nestIntegration, nodeContextIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, parameterize, postgresIntegration, prismaIntegration, requestDataIntegration, setContext, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, setupExpressErrorHandler, setupHapiErrorHandler, spotlightIntegration, startInactiveSpan, startSession, startSpan, startSpanManual, withActiveSpan, withIsolationScope, withMonitor, withScope } from '@sentry/node';
2
+ export { captureConsoleIntegration, debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration } from '@sentry/core';
3
+ export { getDefaultIntegrations, init } from './sdk.js';
4
+ export { googleCloudHttpIntegration } from './integrations/google-cloud-http.js';
5
+ export { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc.js';
6
+ export { wrapCloudEventFunction } from './gcpfunction/cloud_events.js';
7
+ export { wrapHttpFunction } from './gcpfunction/http.js';
8
+ export { wrapEventFunction } from './gcpfunction/events.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}