@sentry/google-cloud-serverless 10.70.0 → 11.0.0-alpha.1

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 (48) hide show
  1. package/build/cjs/gcpfunction/cloud_events.js +4 -1
  2. package/build/cjs/gcpfunction/cloud_events.js.map +1 -1
  3. package/build/cjs/gcpfunction/events.js +4 -1
  4. package/build/cjs/gcpfunction/events.js.map +1 -1
  5. package/build/cjs/gcpfunction/http.js +4 -1
  6. package/build/cjs/gcpfunction/http.js.map +1 -1
  7. package/build/cjs/index.js +4 -7
  8. package/build/cjs/index.js.map +1 -1
  9. package/build/cjs/integrations/google-cloud-grpc.js +7 -2
  10. package/build/cjs/integrations/google-cloud-grpc.js.map +1 -1
  11. package/build/cjs/integrations/google-cloud-http.js +12 -6
  12. package/build/cjs/integrations/google-cloud-http.js.map +1 -1
  13. package/build/cjs/sdk.js.map +1 -1
  14. package/build/esm/gcpfunction/cloud_events.js +4 -1
  15. package/build/esm/gcpfunction/cloud_events.js.map +1 -1
  16. package/build/esm/gcpfunction/events.js +4 -1
  17. package/build/esm/gcpfunction/events.js.map +1 -1
  18. package/build/esm/gcpfunction/http.js +4 -1
  19. package/build/esm/gcpfunction/http.js.map +1 -1
  20. package/build/esm/index.js +1 -1
  21. package/build/esm/integrations/google-cloud-grpc.js +7 -2
  22. package/build/esm/integrations/google-cloud-grpc.js.map +1 -1
  23. package/build/esm/integrations/google-cloud-http.js +13 -7
  24. package/build/esm/integrations/google-cloud-http.js.map +1 -1
  25. package/build/esm/package.json +1 -1
  26. package/build/esm/sdk.js.map +1 -1
  27. package/build/import-hook.mjs +1 -1
  28. package/build/types/gcpfunction/cloud_events.d.ts.map +1 -1
  29. package/build/types/gcpfunction/events.d.ts.map +1 -1
  30. package/build/types/gcpfunction/http.d.ts.map +1 -1
  31. package/build/types/index.d.ts +1 -1
  32. package/build/types/index.d.ts.map +1 -1
  33. package/build/types/integrations/google-cloud-grpc.d.ts.map +1 -1
  34. package/build/types/integrations/google-cloud-http.d.ts.map +1 -1
  35. package/build/types/sdk.d.ts.map +1 -1
  36. package/package.json +10 -23
  37. package/build/loader-hook.mjs +0 -1
  38. package/build/types-ts3.8/debug-build.d.ts +0 -7
  39. package/build/types-ts3.8/gcpfunction/cloud_events.d.ts +0 -11
  40. package/build/types-ts3.8/gcpfunction/events.d.ts +0 -11
  41. package/build/types-ts3.8/gcpfunction/general.d.ts +0 -38
  42. package/build/types-ts3.8/gcpfunction/http.d.ts +0 -10
  43. package/build/types-ts3.8/index.d.ts +0 -9
  44. package/build/types-ts3.8/integrations/gcp-context.d.ts +0 -4
  45. package/build/types-ts3.8/integrations/google-cloud-grpc.d.ts +0 -23
  46. package/build/types-ts3.8/integrations/google-cloud-http.d.ts +0 -9
  47. package/build/types-ts3.8/sdk.d.ts +0 -9
  48. package/build/types-ts3.8/utils.d.ts +0 -18
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const attributes = require('@sentry/conventions/attributes');
4
+ const op = require('@sentry/conventions/op');
3
5
  const core = require('@sentry/core');
4
6
  const node = require('@sentry/node');
5
7
  const debugBuild = require('../debug-build.js');
@@ -17,8 +19,9 @@ function _wrapCloudEventFunction(fn, wrapOptions = {}) {
17
19
  return node.startSpanManual(
18
20
  {
19
21
  name: context.type || "<unknown>",
20
- op: "function.gcp.cloud_event",
21
22
  attributes: {
23
+ [attributes.SENTRY_OP]: op.FAAS_FUNCTION_GCP_SPAN_OP,
24
+ [attributes.FAAS_TRIGGER]: "cloud_event",
22
25
  [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "component",
23
26
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_cloud_event"
24
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cloud_events.js","sources":["../../../src/gcpfunction/cloud_events.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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, 'auto.function.serverless.gcp_cloud_event'));\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 && debug.error(e);\n })\n .then(() => {\n if (typeof callback === 'function') {\n callback(...args);\n }\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, 'auto.function.serverless.gcp_cloud_event'));\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","scope","markEventUnhandled","flush","DEBUG_BUILD","debug","handleCallbackErrors"],"mappings":";;;;;;;AAoBO,SAAS,sBAAA,CACd,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA,OAAOA,mBAAA,CAAc,IAAI,CAAA,CAAA,KAAKC,eAAA,CAAU,wBAAwB,CAAA,EAAG,WAAW,CAAC,CAAC,CAAA;AAClF;AAEA,SAAS,uBAAA,CACP,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA,MAAM,OAAA,GAA4C;AAAA,IAChD,YAAA,EAAc,GAAA;AAAA,IACd,GAAG;AAAA,GACL;AACA,EAAA,OAAO,CAAC,SAAS,QAAA,KAAa;AAC5B,IAAA,OAAOC,oBAAA;AAAA,MACL;AAAA,QACE,IAAA,EAAM,QAAQ,IAAA,IAAQ,WAAA;AAAA,QACtB,EAAA,EAAI,0BAAA;AAAA,QACJ,UAAA,EAAY;AAAA,UACV,CAACC,qCAAgC,GAAG,WAAA;AAAA,UACpC,CAACC,qCAAgC,GAAG;AAAA;AACtC,OACF;AAAA,MACA,CAAA,IAAA,KAAQ;AACN,QAAA,MAAM,QAAQC,oBAAA,EAAgB;AAC9B,QAAA,KAAA,CAAM,UAAA,CAAW,sBAAA,EAAwB,EAAE,GAAG,SAAS,CAAA;AAEvD,QAAA,MAAM,WAAA,GAAcJ,eAAA,CAAU,CAAA,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["../../../src/gcpfunction/cloud_events.ts"],"sourcesContent":["import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';\nimport {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 attributes: {\n [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,\n [FAAS_TRIGGER]: 'cloud_event',\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, 'auto.function.serverless.gcp_cloud_event'));\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 && debug.error(e);\n })\n .then(() => {\n if (typeof callback === 'function') {\n callback(...args);\n }\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, 'auto.function.serverless.gcp_cloud_event'));\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","SENTRY_OP","FAAS_FUNCTION_GCP_SPAN_OP","FAAS_TRIGGER","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getCurrentScope","captureException","scope","markEventUnhandled","flush","DEBUG_BUILD","debug","handleCallbackErrors"],"mappings":";;;;;;;;;AAsBO,SAAS,sBAAA,CACd,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA,OAAOA,mBAAA,CAAc,IAAI,CAAA,CAAA,KAAKC,eAAA,CAAU,wBAAwB,CAAA,EAAG,WAAW,CAAC,CAAC,CAAA;AAClF;AAEA,SAAS,uBAAA,CACP,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA,MAAM,OAAA,GAA4C;AAAA,IAChD,YAAA,EAAc,GAAA;AAAA,IACd,GAAG;AAAA,GACL;AACA,EAAA,OAAO,CAAC,SAAS,QAAA,KAAa;AAC5B,IAAA,OAAOC,oBAAA;AAAA,MACL;AAAA,QACE,IAAA,EAAM,QAAQ,IAAA,IAAQ,WAAA;AAAA,QACtB,UAAA,EAAY;AAAA,UACV,CAACC,oBAAS,GAAGC,4BAAA;AAAA,U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AAO,OAAA,CAAQ,SAAQ,CACpB,IAAA,CAAK,MAAO,EAAA,CAA0B,OAAO,CAAC,CAAA,CAC9C,IAAA;AAAA,UACC,CAAA,MAAA,KAAU,WAAA,CAAY,IAAA,EAAM,MAAM,CAAA;AAAA,UAClC,CAAA,GAAA,KAAO,WAAA,CAAY,GAAA,EAAK,MAAS;AAAA,SACnC;AAAA,MACJ;AAAA,KACF;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const attributes = require('@sentry/conventions/attributes');
4
+ const op = require('@sentry/conventions/op');
3
5
  const core = require('@sentry/core');
4
6
  const node = require('@sentry/node');
5
7
  const debugBuild = require('../debug-build.js');
@@ -18,8 +20,9 @@ function _wrapEventFunction(fn, wrapOptions = {}) {
18
20
  return node.startSpanManual(
19
21
  {
20
22
  name: context.eventType,
21
- op: "function.gcp.event",
22
23
  attributes: {
24
+ [attributes.SENTRY_OP]: op.FAAS_FUNCTION_GCP_SPAN_OP,
25
+ [attributes.FAAS_TRIGGER]: "event",
23
26
  [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "component",
24
27
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_event"
25
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sources":["../../../src/gcpfunction/events.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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, 'auto.function.serverless.gcp_event'));\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 && debug.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, 'auto.function.serverless.gcp_event'));\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_ATTRIBU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,UAAA,IAAA,CAAK,GAAA,EAAI;AAGT,UAAAE,UAAA,CAAM,OAAA,CAAQ,YAAY,CAAA,CACvB,IAAA,CAAK,MAAM,CAAA,CAAA,KAAK;AACf,YAAAC,sBAAA,IAAeC,UAAA,CAAM,MAAM,CAAC,CAAA;AAAA,UAC9B,CAAC,CAAA,CACA,IAAA,CAAK,MAAM;AACV,YAAA,IAAI,OAAO,aAAa,UAAA,EAAY;AAClC,cAAA,QAAA,CAAS,GAAG,IAAI,CAAA;AAAA,YAClB;AAAA,UACF,CAAC,CAAA;AAAA,QACL,CAAC,CAAA;AAED,QAAA,IAAI,EAAA,CAAG,SAAS,CAAA,EAAG;AACjB,UAAA,OAAOC,yBAAA;AAAA,YACL,MAAO,EAAA,CAAiC,IAAA,EAAM,OAAA,EAAS,WAAW,CAAA;AAAA,YAClE,CAAA,GAAA,KAAO;AACL,cAAAN,qBAAA,CAAiB,KAAK,CAAAC,MAAAA,KAASC,wBAAA,CAAmBD,MAAAA,EAAO,oCAAoC,CAAC,CAAA;AAAA,YAChG;AAAA,WACF;AAAA,QACF;AAEA,QAAA,OAAO,OAAA,CAAQ,SAAQ,CACpB,IAAA,CAAK,MAAO,EAAA,CAAqB,IAAA,EAAM,OAAO,CAAC,CAAA,CAC/C,IAAA;AAAA,UACC,CAAA,MAAA,KAAU,WAAA,CAAY,IAAA,EAAM,MAAM,CAAA;AAAA,UAClC,CAAA,GAAA,KAAO,WAAA,CAAY,GAAA,EAAK,MAAS;AAAA,SACnC;AAAA,MACJ;AAAA,KACF;AAAA,EACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"events.js","sources":["../../../src/gcpfunction/events.ts"],"sourcesContent":["import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';\nimport {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 attributes: {\n [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,\n [FAAS_TRIGGER]: 'event',\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, 'auto.function.serverless.gcp_event'));\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 && debug.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, 'auto.function.serverless.gcp_event'));\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","SENTRY_OP","FAAS_FUNCTION_GCP_SPAN_OP","FAAS_TRIGGER","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","getCurrentScope","captureException","scope","markEventUnhandled","flush","DEBUG_BUILD","debug","handleCallbackErrors"],"mappings":";;;;;;;;;AAsBO,SAAS,iBAAA,CACd,EAAA,EACA,WAAA,GAAoD,EAAC,EAC1B;AAC3B,EAAA,OAAOA,mBAAA,CAAc,IAAI,CAAA,CAAA,KAAKC,eAAA,CAAU,mBAAmB,CAAA,EAAG,WAAW,CAAC,CAAC,CAAA;AAC7E;AAGA,SAAS,kBAAA,CACP,EAAA,EACA,WAAA,GAAoD,EAAC,EACM;AAC3D,EAAA,MAAM,OAAA,GAAuC;AAAA,IAC3C,YAAA,EAAc,GAAA;AAAA,IACd,GAAG;AAAA,GACL;AACA,EAAA,OAAO,IAAI,sBAAA,KAAyE;AAClF,IAAA,MAAM,CAAC,IAAA,EAAM,OAAA,EAAS,QAAQ,CAAA,GAAI,sBAAA;AAElC,IAAA,OAAOC,oBAAA;AAAA,MACL;AAAA,QACE,MAAM,OAAA,CAAQ,SAAA;AAAA,QACd,UAAA,EAAY;AAAA,UACV,CAACC,oBAAS,GAAGC,4BAAA;AAAA,UACb,CAACC,uBAAY,GAAG,OAAA;AAAA,UAChB,CAACC,qCAAgC,GAAG,WAAA;AAAA,UACpC,CAACC,qCAAgC,GAAG;AAAA;AACtC,OACF;AAAA,MACA,CAAA,IAAA,KAAQ;AACN,QAA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Y,IAAA,EAAM,MAAM,CAAA;AAAA,UAClC,CAAA,GAAA,KAAO,WAAA,CAAY,GAAA,EAAK,MAAS;AAAA,SACnC;AAAA,MACJ;AAAA,KACF;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const attributes = require('@sentry/conventions/attributes');
4
+ const op = require('@sentry/conventions/op');
3
5
  const core = require('@sentry/core');
4
6
  const node = require('@sentry/node');
5
7
  const debugBuild = require('../debug-build.js');
@@ -27,8 +29,9 @@ function _wrapHttpFunction(fn, options) {
27
29
  return node.startSpanManual(
28
30
  {
29
31
  name: `${reqMethod} ${reqUrl}`,
30
- op: "function.gcp.http",
31
32
  attributes: {
33
+ [attributes.SENTRY_OP]: op.FAAS_FUNCTION_GCP_SPAN_OP,
34
+ [attributes.FAAS_TRIGGER]: "http",
32
35
  [core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route",
33
36
  [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_http"
34
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n setHttpStatus,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 const emulatorFunc = (fn as HttpFunction & { __emulator_func?: HttpFunction }).__emulator_func;\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 const normalizedRequest = httpRequestToRequestData(req);\n getCurrentScope().setSDKProcessingMetadata({ normalizedRequest });\n\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 // 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 && debug.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, 'auto.function.serverless.gcp_http'));\n },\n );\n },\n );\n });\n };\n}\n"],"names":["domainify","proxyFunction","stripUrlQueryAndFragment","isString","continueTrace","httpRequestToRequestData","getCurrentScope","startSpanManual","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","setHttpStatus","flush","DEBUG_BUILD","debug","handleCallbackErrors","captureException","markEventUnhandled"],"mappings":";;;;;;;AAsBO,SAAS,gBAAA,CAAiB,EAAA,EAAkB,WAAA,GAAuC,EAAC,EAAiB;AAC1G,EAAA,MAAM,OAAO,CAAC,CAAA,KAAkCA,gBAAU,iBAAA,CAAkB,CAAA,EAAG,WAAW,CAAC,CAAA;AAE3F,EAAA,IAAI,SAAA;AAIJ,EAAA,MAAM,eAAgB,EAAA,CAAyD,eAAA;AAC/E,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,SAAA,GAAY,EAAE,eAAA,EAAiBC,mBAAA,CAAc,YAAA,EAAc,IAAI,CAAA,EAAE;AAAA,EACnE;AACA,EAAA,OAAOA,mBAAA,CAAc,EAAA,EAAI,IAAA,EAAM,SAAS,CAAA;AAC1C;AAGA,SAAS,iBAAA,CAAkB,IAAkB,OAAA,EAAgD;AAC3F,EAAA,MAAM,YAAA,GAAe,QAAQ,YAAA,IAAgB,GAAA;AAC7C,EAAA,OAAO,CAAC,KAAK,GAAA,KAAQ;AACnB,IAAA,MAAM,SAAA,GAAA,CAAa,GAAA,CAAI,MAAA,IAAU,EAAA,EAAI,WAAA,EAAY;AACjD,IAAA,MAAM,SAASC,6BAAA,CAAyB,GAAA,CAAI,WAAA,IAAe,GAAA,CAAI,OAAO,EAAE,CAAA;AAExE,IAAA,MAAM,WAAA,GAAc,GAAA,CAAI,OAAA,IAAWC,aAAA,CAAS,GAAA,CAAI,OAAA,CAAQ,cAAc,CAAC,CAAA,GAAI,GAAA,CAAI,OAAA,CAAQ,cAAc,CAAA,GAAI,MAAA;AACzG,IAAA,MAAM,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B,KAAA,EAAO,mCAAmC,CAAC,CAAA;AAAA,YAC/F;AAAA,WACF;AAAA,QACF;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';\nimport {\n debug,\n handleCallbackErrors,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n setHttpStatus,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 const emulatorFunc = (fn as HttpFunction & { __emulator_func?: HttpFunction }).__emulator_func;\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 const normalizedRequest = httpRequestToRequestData(req);\n getCurrentScope().setSDKProcessingMetadata({ normalizedRequest });\n\n return startSpanManual(\n {\n name: `${reqMethod} ${reqUrl}`,\n attributes: {\n [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,\n [FAAS_TRIGGER]: 'http',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n },\n },\n span => {\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 && debug.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, 'auto.function.serverless.gcp_http'));\n },\n );\n },\n );\n });\n };\n}\n"],"names":["domainify","proxyFunction","stripUrlQueryAndFragment","isString","continueTrace","httpRequestToRequestData","getCurrentScope","startSpanManual","SENTRY_OP","FAAS_FUNCTION_GCP_SPAN_OP","FAAS_TRIGGER","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","setHttpStatus","flush","DEBUG_BUILD","debug","handleCallbackErrors","captureException","markEventUnhandled"],"mappings":";;;;;;;;;AAwBO,SAAS,gBAAA,CAAiB,EAAA,EAAkB,WAAA,GAAuC,EAAC,EAAiB;AAC1G,EAAA,MAAM,OA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EAAY;AAAA,YACV,CAACC,oBAAS,GAAGC,4BAAA;AAAA,YACb,CAACC,uBAAY,GAAG,MAAA;AAAA,YAChB,CAACC,qCAAgC,GAAG,OAAA;AAAA,YACpC,CAACC,qCAAgC,GAAG;AAAA;AACtC,SACF;AAAA,QACA,CAAA,IAAA,KAAQ;AAEN,UAAA,MAAM,OAAO,GAAA,CAAI,GAAA;AAEjB,UAAA,GAAA,CAAI,GAAA,GAAM,SAAU,KAAA,EAA4B,QAAA,EAAkC,EAAA,EAAsB;AACtG,YAAAC,kBAAA,CAAc,IAAA,EAAM,IAAI,UAAU,CAAA;AAClC,YAAA,IAAA,CAAK,GAAA,EAAI;AAGT,YAAAC,UAAA,CAAM,YAAY,CAAA,CACf,IAAA,CAAK,IAAA,EAAM,CAAA,CAAA,KAAK;AACf,cAAAC,sBAAA,IAAeC,UAAA,CAAM,MAAM,CAAC,CAAA;AAAA,YAC9B,CAAC,CAAA,CACA,IAAA,CAAK,MAAM;AACV,cAAA,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,KAAA,EAAO,QAAA,EAAU,EAAE,CAAA;AAAA,YACrC,CAAC,CAAA;AAAA,UACL,CAAA;AAEA,UAAA,OAAOC,yBAAA;AAAA,YACL,MAAM,EAAA,CAAG,GAAA,EAAK,GAAG,CAAA;AAAA,YACjB,CAAA,GAAA,KAAO;AACL,cAAAC,qBAAA,CAAiB,GAAA,EAAK,CAAA,KAAA,KAASC,wBAAA,CAAmB,KAAA,EAAO,mCAAmC,CAAC,CAAA;AAAA,YAC/F;AAAA,WACF;AAAA,QACF;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH,CAAA;AACF;;;;"}
@@ -36,7 +36,6 @@ exports.captureMessage = node.captureMessage;
36
36
  exports.captureSession = node.captureSession;
37
37
  exports.childProcessIntegration = node.childProcessIntegration;
38
38
  exports.close = node.close;
39
- exports.connectIntegration = node.connectIntegration;
40
39
  exports.consoleIntegration = node.consoleIntegration;
41
40
  exports.consoleLoggingIntegration = node.consoleLoggingIntegration;
42
41
  exports.contextLinesIntegration = node.contextLinesIntegration;
@@ -60,7 +59,6 @@ exports.firebaseIntegration = node.firebaseIntegration;
60
59
  exports.flush = node.flush;
61
60
  exports.fsIntegration = node.fsIntegration;
62
61
  exports.functionToStringIntegration = node.functionToStringIntegration;
63
- exports.generateInstrumentOnce = node.generateInstrumentOnce;
64
62
  exports.genericPoolIntegration = node.genericPoolIntegration;
65
63
  exports.getActiveSpan = node.getActiveSpan;
66
64
  exports.getAutoPerformanceIntegrations = node.getAutoPerformanceIntegrations;
@@ -68,6 +66,7 @@ exports.getClient = node.getClient;
68
66
  exports.getCurrentScope = node.getCurrentScope;
69
67
  exports.getGlobalScope = node.getGlobalScope;
70
68
  exports.getIsolationScope = node.getIsolationScope;
69
+ exports.getOtlpTracesEndpoint = node.getOtlpTracesEndpoint;
71
70
  exports.getRootSpan = node.getRootSpan;
72
71
  exports.getSentryRelease = node.getSentryRelease;
73
72
  exports.getSpanDescendants = node.getSpanDescendants;
@@ -78,17 +77,14 @@ exports.googleGenAIIntegration = node.googleGenAIIntegration;
78
77
  exports.graphqlIntegration = node.graphqlIntegration;
79
78
  exports.growthbookIntegration = node.growthbookIntegration;
80
79
  exports.hapiIntegration = node.hapiIntegration;
81
- exports.honoIntegration = node.honoIntegration;
82
80
  exports.httpHeadersToSpanAttributes = node.httpHeadersToSpanAttributes;
83
81
  exports.httpIntegration = node.httpIntegration;
84
82
  exports.httpServerIntegration = node.httpServerIntegration;
85
83
  exports.httpServerSpansIntegration = node.httpServerSpansIntegration;
86
- exports.inboundFiltersIntegration = node.inboundFiltersIntegration;
87
84
  exports.initOpenTelemetry = node.initOpenTelemetry;
88
85
  exports.instrumentAnthropicAiClient = node.instrumentAnthropicAiClient;
89
86
  exports.instrumentGoogleGenAIClient = node.instrumentGoogleGenAIClient;
90
87
  exports.instrumentLangChainEmbeddings = node.instrumentLangChainEmbeddings;
91
- exports.instrumentLangGraph = node.instrumentLangGraph;
92
88
  exports.instrumentOpenAiClient = node.instrumentOpenAiClient;
93
89
  exports.instrumentStateGraph = node.instrumentStateGraph;
94
90
  exports.instrumentStateGraphCompile = node.instrumentStateGraphCompile;
@@ -120,6 +116,7 @@ exports.onUncaughtExceptionIntegration = node.onUncaughtExceptionIntegration;
120
116
  exports.onUnhandledRejectionIntegration = node.onUnhandledRejectionIntegration;
121
117
  exports.openAIIntegration = node.openAIIntegration;
122
118
  exports.openFeatureIntegration = node.openFeatureIntegration;
119
+ exports.otlpIntegration = node.otlpIntegration;
123
120
  exports.parameterize = node.parameterize;
124
121
  exports.pinoIntegration = node.pinoIntegration;
125
122
  exports.postgresIntegration = node.postgresIntegration;
@@ -141,14 +138,13 @@ exports.setMeasurement = node.setMeasurement;
141
138
  exports.setTag = node.setTag;
142
139
  exports.setTags = node.setTags;
143
140
  exports.setUser = node.setUser;
144
- exports.setupConnectErrorHandler = node.setupConnectErrorHandler;
145
141
  exports.setupExpressErrorHandler = node.setupExpressErrorHandler;
146
142
  exports.setupHapiErrorHandler = node.setupHapiErrorHandler;
147
- exports.setupHonoErrorHandler = node.setupHonoErrorHandler;
148
143
  exports.setupKoaErrorHandler = node.setupKoaErrorHandler;
149
144
  exports.spanStreamingIntegration = node.spanStreamingIntegration;
150
145
  exports.spanToBaggageHeader = node.spanToBaggageHeader;
151
146
  exports.spanToJSON = node.spanToJSON;
147
+ exports.spanToStaticSpanJSON = node.spanToStaticSpanJSON;
152
148
  exports.spanToTraceHeader = node.spanToTraceHeader;
153
149
  exports.spotlightIntegration = node.spotlightIntegration;
154
150
  exports.startInactiveSpan = node.startInactiveSpan;
@@ -170,6 +166,7 @@ exports.withActiveSpan = node.withActiveSpan;
170
166
  exports.withIsolationScope = node.withIsolationScope;
171
167
  exports.withMonitor = node.withMonitor;
172
168
  exports.withScope = node.withScope;
169
+ exports.withStaticSpan = node.withStaticSpan;
173
170
  exports.withStreamedSpan = node.withStreamedSpan;
174
171
  exports.wrapMcpServerWithSentry = node.wrapMcpServerWithSentry;
175
172
  exports.zodErrorsIntegration = node.zodErrorsIntegration;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const attributes = require('@sentry/conventions/attributes');
4
+ const op = require('@sentry/conventions/op');
3
5
  const core = require('@sentry/core');
4
6
  const node = require('@sentry/node');
5
7
 
@@ -65,9 +67,12 @@ function fillGrpcFunction(stub, serviceIdentifier, methodName) {
65
67
  const span = node.startInactiveSpan({
66
68
  name: `${callType} ${methodName}`,
67
69
  onlyIfParent: true,
68
- op: `grpc.${serviceIdentifier}`,
69
70
  attributes: {
70
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.grpc.serverless"
71
+ [attributes.SENTRY_OP]: op.FAAS_GRPC_SPAN_OP,
72
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.grpc.serverless",
73
+ [attributes.RPC_SYSTEM_NAME]: "grpc",
74
+ [attributes.RPC_SERVICE]: serviceIdentifier,
75
+ [attributes.RPC_METHOD]: methodName
71
76
  }
72
77
  });
73
78
  ret.on("status", () => {
@@ -1 +1 @@
1
- {"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface 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\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc' as const;\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 */\nexport function 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?.[1] || servicePath;\n}\n"],"names":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;AA2BA,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,Q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,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;;"}
1
+ {"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_GRPC_SPAN_OP } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface 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\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc' as const;\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 */\nexport function 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 attributes: {\n [SENTRY_OP]: FAAS_GRPC_SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',\n [RPC_SYSTEM_NAME]: 'grpc',\n [RPC_SERVICE]: serviceIdentifier,\n [RPC_METHOD]: methodName,\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?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AAA,QAC/B,YAAA,EAAc,IAAA;AAAA,QACd,UAAA,EAAY;AAAA,UACV,CAACC,oBAAS,GAAGC,oBAAA;AAAA,UACb,CAACC,qCAAgC,GAAG,sBAAA;AAAA,UACpC,CAACC,0BAAe,GAAG,MAAA;AAAA,UACnB,CAACC,sBAAW,GAAG,iBAAA;AAAA,UACf,CAACC,qBAAU,GAAG;AAAA;AAChB,OACD,CAAA;AACD,MAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,IAAA,CAAK,GAAA,EAAI;AAAA,QACX;AAAA,MACF,CAAC,CAAA;AACD,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACJ;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;;"}
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const attributes = require('@sentry/conventions/attributes');
4
+ const op = require('@sentry/conventions/op');
3
5
  const core = require('@sentry/core');
4
6
  const node = require('@sentry/node');
5
7
 
@@ -29,11 +31,15 @@ function wrapRequestFunction(orig) {
29
31
  return function(reqOpts, callback) {
30
32
  const httpMethod = reqOpts.method || "GET";
31
33
  const span = SETUP_CLIENTS.has(core.getClient()) ? node.startInactiveSpan({
32
- name: `${httpMethod} ${reqOpts.uri}`,
34
+ // Span names must not contain a query string, and callers can pass any URI they want.
35
+ name: `${httpMethod} ${core.stripUrlQueryAndFragment(reqOpts.uri)}`,
33
36
  onlyIfParent: true,
34
- op: `http.client.${identifyService(this.apiEndpoint)}`,
35
37
  attributes: {
36
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.serverless"
38
+ [attributes.SENTRY_OP]: op.WEB_SERVER_HTTP_CLIENT_SPAN_OP,
39
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.serverless",
40
+ [attributes.HTTP_REQUEST_METHOD]: httpMethod,
41
+ [attributes.SERVER_ADDRESS]: getServerAddress(this.apiEndpoint),
42
+ [attributes.URL_FULL]: core.filterCollectedUrl(reqOpts.uri)
37
43
  }
38
44
  }) : new core.SentryNonRecordingSpan();
39
45
  orig.call(this, reqOpts, (...args) => {
@@ -42,9 +48,9 @@ function wrapRequestFunction(orig) {
42
48
  });
43
49
  };
44
50
  }
45
- function identifyService(apiEndpoint) {
46
- const match = apiEndpoint.match(/^https:\/\/(\w+)\.googleapis.com$/);
47
- return match?.[1] || apiEndpoint.replace(/^(http|https)?:\/\//, "");
51
+ function getServerAddress(apiEndpoint) {
52
+ const url = core.parseStringToURLObject(apiEndpoint);
53
+ return url && !core.isURLObjectRelative(url) ? url.host : apiEndpoint;
48
54
  }
49
55
 
50
56
  exports.googleCloudHttpIntegration = googleCloudHttpIntegration;
@@ -1 +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 type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\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' as const;\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?.[1] || apiEndpoint.replace(/^(http|https)?:\\/\\//, '');\n}\n"],"names":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SentryNonRecordingSpan"],"mappings":";;;;;AAkBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAA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,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,mCAAmC,CAAA;AACnE,EAAA,OAAO,QAAQ,CAAC,CAAA,IAAK,WAAA,CAAY,OAAA,CAAQ,uBAAuB,EAAE,CAAA;AACpE;;;;"}
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 { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_FULL } from '@sentry/conventions/attributes';\nimport { WEB_SERVER_HTTP_CLIENT_SPAN_OP } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n isURLObjectRelative,\n parseStringToURLObject,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n filterCollectedUrl,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\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' as const;\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 // Span names must not contain a query string, and callers can pass any URI they want.\n name: `${httpMethod} ${stripUrlQueryAndFragment(reqOpts.uri)}`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: WEB_SERVER_HTTP_CLIENT_SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n [HTTP_REQUEST_METHOD]: httpMethod,\n [SERVER_ADDRESS]: getServerAddress(this.apiEndpoint),\n [URL_FULL]: filterCollectedUrl(reqOpts.uri),\n },\n })\n : new SentryNonRecordingSpan();\n orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {\n span.end();\n callback(...args);\n });\n };\n}\n\n/** Extracts the host of the API endpoint the request is sent to */\nfunction getServerAddress(apiEndpoint: string): string {\n const url = parseStringToURLObject(apiEndpoint);\n return url && !isURLObjectRelative(url) ? url.host : apiEndpoint;\n}\n"],"names":["fill","defineIntegration","getClient","startInactiveSpan","stripUrlQueryAndFragment","SENTRY_OP","WEB_SERVER_HTTP_CLIENT_SPAN_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","HTTP_REQUEST_METHOD","SERVER_ADDRESS","URL_FULL","filterCollectedUrl","SentryNonRecordingSpan","parseStringToURLObject","isURLObjectRelative"],"mappings":";;;;;;;AAwBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA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AAA,GAAI,IAAA,KAAuC;AAClE,MAAA,IAAA,CAAK,GAAA,EAAI;AACT,MAAA,QAAA,CAAS,GAAG,IAAI,CAAA;AAAA,IAClB,CAAC,CAAA;AAAA,EACH,CAAA;AACF;AAGA,SAAS,iBAAiB,WAAA,EAA6B;AACrD,EAAA,MAAM,GAAA,GAAMC,4BAAuB,WAAW,CAAA;AAC9C,EAAA,OAAO,OAAO,CAACC,wBAAA,CAAoB,GAAG,CAAA,GAAI,IAAI,IAAA,GAAO,WAAA;AACvD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { getDefaultIntegrationsWithoutPerformance, init as initNode } from '@sentry/node';\nimport { gcpContextIntegration } from './integrations/gcp-context';\nimport { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';\nimport { googleCloudHttpIntegration } from './integrations/google-cloud-http';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n /*! rollup-include-cjs-only */\n return [\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 /*! rollup-include-cjs-only-end */\n /*! rollup-include-esm-only */\n return [];\n /*! rollup-include-esm-only-end */\n}\n\n/** Get the default integrations for the GCP SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n return [...getDefaultIntegrationsWithoutPerformance(), gcpContextIntegration(), ...getCjsOnlyIntegrations()];\n}\n\n/**\n * @see {@link Sentry.init}\n */\nexport function init(options: NodeOptions = {}): NodeClient | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'google-cloud-serverless', ['google-cloud-serverless', 'node']);\n\n return initNode(opts);\n}\n"],"names":["googleCloudHttpIntegration","googleCloudGrpcIntegration","getDefaultIntegrationsWithoutPerformance","gcpContextIntegration","applySdkMetadata","initNode"],"mappings":";;;;;;;;AAQA,SAAS,sBAAA,GAAwC;AAAA,EAC/C,OAAA;AACA,IAAAA,0CAAO,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;AAAA;AACwC,IAAAC,0CAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA;AAAA;AACA,GAAA;AAAA,EAC/C;AACA,SAAA,sBAAA,CAAA,QAAA,EAAA;AAAA,EACA,OAAA,CAAA,GAAAC,6CAAA,EAAA,EAAAC,gCAAA,EAAA,EAAA,GAAA,sBAAA,EAAA,CAAA;AACA;AACA,SAAA,IAAA,CAAA,OAAA,GAAA,EAAA,EAAA;AACF,EAAA,MAAA,IAAA,GAAA;AAGO,IAAA,2CAAgC,CAAkC,CAAA;AACvE,IAAA,GAAA;AACF,GAAA;AAKO,EAAAC,qBAAS,CAAA,IAAK,EAAA,yBAAmD,EAAA,CAAA,yBAAA,EAAA,MAAA,CAAA,CAAA;AACtE,EAAA,OAAMC,SAAO,CAAA,IAAA,CAAA;AAAA;;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { getDefaultIntegrationsWithoutPerformance, init as initNode } from '@sentry/node';\nimport { gcpContextIntegration } from './integrations/gcp-context';\nimport { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';\nimport { googleCloudHttpIntegration } from './integrations/google-cloud-http';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n /*! rollup-include-cjs-only */\n return [\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 /*! rollup-include-cjs-only-end */\n /*! rollup-include-esm-only */\n // oxlint-disable-next-line no-unreachable -- reachable only in the ESM build; rollup strips the CJS return above\n return [];\n /*! rollup-include-esm-only-end */\n}\n\n/** Get the default integrations for the GCP SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n return [...getDefaultIntegrationsWithoutPerformance(), gcpContextIntegration(), ...getCjsOnlyIntegrations()];\n}\n\n/**\n * @see {@link Sentry.init}\n */\nexport function init(options: NodeOptions = {}): NodeClient | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'google-cloud-serverless', ['google-cloud-serverless', 'node']);\n\n return initNode(opts);\n}\n"],"names":["googleCloudHttpIntegration","googleCloudGrpcIntegration","getDefaultIntegrationsWithoutPerformance","gcpContextIntegration","applySdkMetadata","initNode"],"mappings":";;;;;;;;AAQA,SAAS,sBAAA,GAAwC;AAAA,EAC/C,OAAA;AACA,IAAAA,0CAAO,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;AAAA;AACwC,IAAAC,0CAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA;AAAA;AACA,GAAA;AAAA,EAC/C;AACA,SAAA,sBAAA,CAAA,QAAA,EAAA;AAAA,EACA,OAAA,CAAA,GAAAC,6CAAA,EAAA,EAAAC,gCAAA,EAAA,EAAA,GAAA,sBAAA,EAAA,CAAA;AAEA;AACA,SAAA,IAAA,CAAA,OAAA,GAAA,EAAA,EAAA;AACF,EAAA,MAAA,IAAA,GAAA;AAGO,IAAA,2CAAgC,CAAkC,CAAA;AACvE,IAAA,GAAA;AACF,GAAA;AAKO,EAAAC,qBAAS,CAAA,IAAK,EAAA,yBAAmD,EAAA,CAAA,yBAAA,EAAA,MAAA,CAAA,CAAA;AACtE,EAAA,OAAMC,SAAO,CAAA,IAAA,CAAA;AAAA;;;;;"}
@@ -1,3 +1,5 @@
1
+ import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';
2
+ import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';
1
3
  import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, handleCallbackErrors, debug } from '@sentry/core';
2
4
  import { startSpanManual, getCurrentScope, captureException, flush } from '@sentry/node';
3
5
  import { DEBUG_BUILD } from '../debug-build.js';
@@ -15,8 +17,9 @@ function _wrapCloudEventFunction(fn, wrapOptions = {}) {
15
17
  return startSpanManual(
16
18
  {
17
19
  name: context.type || "<unknown>",
18
- op: "function.gcp.cloud_event",
19
20
  attributes: {
21
+ [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,
22
+ [FAAS_TRIGGER]: "cloud_event",
20
23
  [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "component",
21
24
  [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_cloud_event"
22
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cloud_events.js","sources":["../../../src/gcpfunction/cloud_events.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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, 'auto.function.serverless.gcp_cloud_event'));\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 && debug.error(e);\n })\n .then(() => {\n if (typeof callback === 'function') {\n callback(...args);\n }\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, 'auto.function.serverless.gcp_cloud_event'));\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":["scope"],"mappings":";;;;;AAoBO,SAAS,sBAAA,CACd,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA,OAAO,aAAA,CAAc,IAAI,CAAA,CAAA,KAAK,SAAA,CAAU,wBAAwB,CAAA,EAAG,WAAW,CAAC,CAAC,CAAA;AAClF;AAEA,SAAS,uBAAA,CACP,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA,MAAM,OAAA,GAA4C;AAAA,IAChD,YAAA,EA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AAA,YACjE,CAAA,GAAA,KAAO;AACL,cAAA,gBAAA,CAAiB,KAAK,CAAAA,MAAAA,KAAS,kBAAA,CAAmBA,MAAAA,EAAO,0CAA0C,CAAC,CAAA;AAAA,YACtG;AAAA,WACF;AAAA,QACF;AAEA,QAAA,OAAO,OAAA,CAAQ,SAAQ,CACpB,IAAA,CAAK,MAAO,EAAA,CAA0B,OAAO,CAAC,CAAA,CAC9C,IAAA;AAAA,UACC,CAAA,MAAA,KAAU,WAAA,CAAY,IAAA,EAAM,MAAM,CAAA;AAAA,UAClC,CAAA,GAAA,KAAO,WAAA,CAAY,GAAA,EAAK,MAAS;AAAA,SACnC;AAAA,MACJ;AAAA,KACF;AAAA,EACF,CAAA;AACF;;;;"}
1
+ {"version":3,"file":"cloud_events.js","sources":["../../../src/gcpfunction/cloud_events.ts"],"sourcesContent":["import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';\nimport {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 attributes: {\n [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,\n [FAAS_TRIGGER]: 'cloud_event',\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, 'auto.function.serverless.gcp_cloud_event'));\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 && debug.error(e);\n })\n .then(() => {\n if (typeof callback === 'function') {\n callback(...args);\n }\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, 'auto.function.serverless.gcp_cloud_event'));\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":["scope"],"mappings":";;;;;;;AAsBO,SAAS,sBAAA,CACd,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA,OAAO,aAAA,CAAc,IAAI,CAAA,CAAA,KAAK,SAAA,CAAU,wBAAwB,CAAA,EAAG,WAAW,CAAC,CAAC,CAAA;AAClF;AAEA,SAAS,uBAAA,CACP,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AAChC,EAAA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;AACjB,UAAA,OAAO,oBAAA;AAAA,YACL,MAAO,EAAA,CAAsC,OAAA,EAAS,WAAW,CAAA;AAAA,YACjE,CAAA,GAAA,KAAO;AACL,cAAA,gBAAA,CAAiB,KAAK,CAAAA,MAAAA,KAAS,kBAAA,CAAmBA,MAAAA,EAAO,0CAA0C,CAAC,CAAA;AAAA,YACtG;AAAA,WACF;AAAA,QACF;AAEA,QAAA,OAAO,OAAA,CAAQ,SAAQ,CACpB,IAAA,CAAK,MAAO,EAAA,CAA0B,OAAO,CAAC,CAAA,CAC9C,IAAA;AAAA,UACC,CAAA,MAAA,KAAU,WAAA,CAAY,IAAA,EAAM,MAAM,CAAA;AAAA,UAClC,CAAA,GAAA,KAAO,WAAA,CAAY,GAAA,EAAK,MAAS;AAAA,SACnC;AAAA,MACJ;AAAA,KACF;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,3 +1,5 @@
1
+ import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';
2
+ import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';
1
3
  import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, handleCallbackErrors, debug } from '@sentry/core';
2
4
  import { startSpanManual, getCurrentScope, captureException, flush } from '@sentry/node';
3
5
  import { DEBUG_BUILD } from '../debug-build.js';
@@ -16,8 +18,9 @@ function _wrapEventFunction(fn, wrapOptions = {}) {
16
18
  return startSpanManual(
17
19
  {
18
20
  name: context.eventType,
19
- op: "function.gcp.event",
20
21
  attributes: {
22
+ [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,
23
+ [FAAS_TRIGGER]: "event",
21
24
  [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "component",
22
25
  [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_event"
23
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sources":["../../../src/gcpfunction/events.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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, 'auto.function.serverless.gcp_event'));\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 && debug.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, 'auto.function.serverless.gcp_event'));\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":["scope"],"mappings":";;;;;AAoBO,SAAS,iBAAA,CACd,EAAA,EACA,WAAA,GAAoD,EAAC,EAC1B;AAC3B,EAAA,OAAO,aAAA,CAAc,IAAI,CAAA,CAAA,KAAK,SAAA,CAAU,mBAAmB,CAAA,EAAG,WAAW,CAAC,CAAC,CAAA;AAC7E;AAGA,SAAS,kBAAA,CACP,EAAA,EACA,WAAA,GAAoD,EAAC,EACM;AAC3D,EAAA,MAAM,OAAA,GAAuC;AAAA,IAC3C,YAAA,EAAc,GAAA;AAAA,IACd,GAAG;AAAA,GACL;AACA,EAAA,OAAO,IAAI,sBAAA,KAAyE;AAClF,IAAA,MAAM,CAAC,IAAA,EAAM,OAAA,EAAS,QAAQ,CAAA,GAAI,sBAAA;AAElC,IAAA,OAAO,eAAA;AAAA,MACL;AAAA,QACE,MAAM,OAAA,CAAQ,SAAA;AAAA,QACd,EAAA,EAAI,oBAAA;AAAA,QACJ,UAAA,EAAY;AAAA,UACV,CAAC,gCAAgC,GAAG,WAAA;AAAA,UACpC,CAAC,gCAAgC,GAAG;AAAA;AACtC,OACF;AAAA,MACA,CAAA,IAAA,KAAQ;AACN,QAAA,MAAM,QAAQ,eAAA,EAAgB;AAC9B,QAAA,KAAA,CAAM,UAAA,CAAW,sBAAA,EAAwB,EAAE,GAAG,SAAS,CAAA;AAEvD,QAAA,MAAM,WAAA,GAAc,SAAA,CAAU,CAAA,GAAI,IAAA,KAAoB;AACpD,UAAA,IAAI,KAAK,CAAC,C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_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';\nimport {\n debug,\n handleCallbackErrors,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 attributes: {\n [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,\n [FAAS_TRIGGER]: 'event',\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, 'auto.function.serverless.gcp_event'));\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 && debug.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, 'auto.function.serverless.gcp_event'));\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":["scope"],"mappings":";;;;;;;AAsBO,SAAS,iBAAA,CACd,EAAA,EACA,WAAA,GAAoD,EAAC,EAC1B;AAC3B,EAAA,OAAO,aAAA,CAAc,IAAI,CAAA,CAAA,KAAK,SAAA,CAAU,mBAAmB,CAAA,EAAG,WAAW,CAAC,CAAC,CAAA;AAC7E;AAGA,SAAS,kBAAA,CACP,EAAA,EACA,WAAA,GAAoD,EAAC,EACM;AAC3D,EAAA,MAAM,OAAA,GAAuC;AAAA,IAC3C,YAAA,EAAc,GAAA;AAAA,IACd,GAAG;AAAA,GACL;AACA,EAAA,OAAO,IAAI,sBAAA,KAAyE;AAClF,IAAA,MAAM,CAAC,IAAA,EAAM,OAAA,EAAS,QAAQ,CAAA,GAAI,sBAAA;AAElC,IAAA,OAAO,eAAA;AAAA,MACL;AAAA,QACE,MAAM,OAAA,CAAQ,SAAA;AAAA,QACd,UAAA,EAAY;AAAA,UACV,CAAC,SAAS,GAAG,yBAAA;AAAA,UACb,CAAC,YAAY,GAAG,OAAA;AAAA,UAChB,CAAC,gCAAgC,GAAG,WAAA;AAAA,UACpC,CAAC,gCAAgC,GAAG;AAAA;AACtC,OACF;AAAA,MACA,CAAA,IAAA,KAAQ;AACN,QAAA,MAAM,QAAQ,eAAA,EAAgB;AAC9B,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A,KAAO,WAAA,CAAY,GAAA,EAAK,MAAS;AAAA,SACnC;AAAA,MACJ;AAAA,KACF;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,3 +1,5 @@
1
+ import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';
2
+ import { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';
1
3
  import { stripUrlQueryAndFragment, isString, httpRequestToRequestData, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus, debug, handleCallbackErrors } from '@sentry/core';
2
4
  import { continueTrace, getCurrentScope, startSpanManual, flush, captureException } from '@sentry/node';
3
5
  import { DEBUG_BUILD } from '../debug-build.js';
@@ -25,8 +27,9 @@ function _wrapHttpFunction(fn, options) {
25
27
  return startSpanManual(
26
28
  {
27
29
  name: `${reqMethod} ${reqUrl}`,
28
- op: "function.gcp.http",
29
30
  attributes: {
31
+ [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,
32
+ [FAAS_TRIGGER]: "http",
30
33
  [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route",
31
34
  [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_http"
32
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n setHttpStatus,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 const emulatorFunc = (fn as HttpFunction & { __emulator_func?: HttpFunction }).__emulator_func;\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 const normalizedRequest = httpRequestToRequestData(req);\n getCurrentScope().setSDKProcessingMetadata({ normalizedRequest });\n\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 // 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 && debug.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, 'auto.function.serverless.gcp_http'));\n },\n );\n },\n );\n });\n };\n}\n"],"names":[],"mappings":";;;;;AAsBO,SAAS,gBAAA,CAAiB,EAAA,EAAkB,WAAA,GAAuC,EAAC,EAAiB;AAC1G,EAAA,MAAM,OAAO,CAAC,CAAA,KAAkC,UAAU,iBAAA,CAAkB,CAAA,EAAG,WAAW,CAAC,CAAA;AAE3F,EAAA,IAAI,SAAA;AAIJ,EAAA,MAAM,eAAgB,EAAA,CAAyD,eAAA;AAC/E,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,SAAA,GAAY,EAAE,eAAA,EAAiB,aAAA,CAAc,YAAA,EAAc,IAAI,CAAA,EAAE;AAAA,EACnE;AACA,EAAA,OAAO,aAAA,CAAc,EAAA,EAAI,IAAA,EAAM,SAAS,CAAA;AAC1C;AAGA,SAAS,iBAAA,CAAkB,IAAkB,OAAA,EAAgD;AAC3F,EAAA,MAAM,YAAA,GAAe,QAAQ,YAAA,IAAgB,GAAA;AAC7C,EAAA,OAAO,CAAC,KAAK,GAAA,KAAQ;AACnB,IAAA,MAAM,SAAA,GAAA,CAAa,GAAA,CAAI,MAAA,IAAU,EAAA,EAAI,WAAA,EAAY;AACjD,IAAA,MAAM,SAAS,wBAAA,CAAyB,GAAA,CAAI,WAAA,IAAe,GAAA,CAAI,OAAO,EAAE,CAAA;AAExE,IAAA,MAAM,WAAA,GAAc,GAAA,CAAI,OAAA,IAAW,QAAA,CAAS,GAAA,CAAI,OAAA,CAAQ,cAAc,CAAC,CAAA,GAAI,GAAA,CAAI,OAAA,CAAQ,cAAc,CAAA,GAAI,MAAA;AACzG,IAAA,MAAM,OAAA,GAAU,IAAI,OAAA,EAAS,OAAA;AAE7B,IAAA,OAAO,aAAA,CAAc,EAAE,WAAA,EAAa,OAAA,IAAW,MAAM;AACnD,MAAA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1
+ {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import { FAAS_TRIGGER, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_FUNCTION_GCP_SPAN_OP } from '@sentry/conventions/op';\nimport {\n debug,\n handleCallbackErrors,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n setHttpStatus,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node';\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 const emulatorFunc = (fn as HttpFunction & { __emulator_func?: HttpFunction }).__emulator_func;\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 const normalizedRequest = httpRequestToRequestData(req);\n getCurrentScope().setSDKProcessingMetadata({ normalizedRequest });\n\n return startSpanManual(\n {\n name: `${reqMethod} ${reqUrl}`,\n attributes: {\n [SENTRY_OP]: FAAS_FUNCTION_GCP_SPAN_OP,\n [FAAS_TRIGGER]: 'http',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n },\n },\n span => {\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 && debug.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, 'auto.function.serverless.gcp_http'));\n },\n );\n },\n );\n });\n };\n}\n"],"names":[],"mappings":";;;;;;;AAwBO,SAAS,gBAAA,CAAiB,EAAA,EAAkB,WAAA,GAAuC,EAAC,EAAiB;AAC1G,EAAA,MAAM,OAAO,CAAC,CAAA,KAAkC,UAAU,iBAAA,CAAkB,CAAA,EAAG,WAAW,CAAC,CAAA;AAE3F,EAAA,IAAI,SAAA;AAIJ,EAAA,MAAM,eAAgB,EAAA,CAAyD,eAAA;AAC/E,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,SAAA,GAAY,EAAE,eAAA,EAAiB,aAAA,CAAc,YAAA,EAAc,IAAI,CAAA,EAAE;AAAA,EACnE;AACA,EAAA,OAAO,aAAA,CAAc,EAAA,EAAI,IAAA,EAAM,SAAS,CAAA;AAC1C;AAGA,SAAS,iBAAA,CAAkB,IAAkB,OAAA,EAAgD;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;AAGT,YAAA,KAAA,CAAM,YAAY,CAAA,CACf,IAAA,CAAK,IAAA,EAAM,CAAA,CAAA,KAAK;AACf,cAAA,WAAA,IAAe,KAAA,CAAM,MAAM,CAAC,CAAA;AAAA,YAC9B,CAAC,CAAA,CACA,IAAA,CAAK,MAAM;AACV,cAAA,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,KAAA,EAAO,QAAA,EAAU,EAAE,CAAA;AAAA,YACrC,CAAC,CAAA;AAAA,UACL,CAAA;AAEA,UAAA,OAAO,oBAAA;AAAA,YACL,MAAM,EAAA,CAAG,GAAA,EAAK,GAAG,CAAA;AAAA,YACjB,CAAA,GAAA,KAAO;AACL,cAAA,gBAAA,CAAiB,GAAA,EAAK,CAAA,KAAA,KAAS,kBAAA,CAAmB,KAAA,EAAO,mCAAmC,CAAC,CAAA;AAAA,YAC/F;AAAA,WACF;AAAA,QACF;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH,CAAA;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- export { NODE_VERSION, NodeClient, OpenFeatureIntegrationHook, SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, amqplibIntegration, anrIntegration, anthropicAIIntegration, bindScopeToEmitter, buildLaunchDarklyFlagUsedHandler, captureCheckIn, captureEvent, captureException, captureFeedback, captureMessage, captureSession, childProcessIntegration, close, connectIntegration, consoleIntegration, consoleLoggingIntegration, contextLinesIntegration, continueTrace, createConsolaReporter, createGetModuleFromFilename, createLangChainCallbackHandler, createSentryWinstonTransport, createTransport, cron, dataloaderIntegration, defaultStackParser, disableAnrDetectionForCallback, endSession, eventFiltersIntegration, expressErrorHandler, expressIntegration, fastifyIntegration, featureFlagsIntegration, firebaseIntegration, flush, fsIntegration, functionToStringIntegration, generateInstrumentOnce, genericPoolIntegration, getActiveSpan, getAutoPerformanceIntegrations, getClient, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, getSentryRelease, getSpanDescendants, getSpanStatusFromHttpCode, getTraceData, getTraceMetaTags, googleGenAIIntegration, graphqlIntegration, growthbookIntegration, hapiIntegration, honoIntegration, httpHeadersToSpanAttributes, httpIntegration, httpServerIntegration, httpServerSpansIntegration, inboundFiltersIntegration, initOpenTelemetry, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, instrumentLangChainEmbeddings, instrumentLangGraph, instrumentOpenAiClient, instrumentStateGraph, instrumentStateGraphCompile, instrumentSupabaseClient, isEnabled, isInitialized, kafkaIntegration, knexIntegration, koaIntegration, langChainIntegration, langGraphIntegration, lastEventId, launchDarklyIntegration, linkedErrorsIntegration, localVariablesIntegration, logger, lruMemoizerIntegration, makeNodeTransport, metrics, modulesIntegration, mongoIntegration, mongooseIntegration, mysql2Integration, mysqlIntegration, nativeNodeFetchIntegration, nodeContextIntegration, nodeRuntimeMetricsIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, openAIIntegration, openFeatureIntegration, parameterize, pinoIntegration, postgresIntegration, postgresJsIntegration, prismaIntegration, processSessionIntegration, profiler, redisIntegration, requestDataIntegration, setAttribute, setAttributes, setContext, setConversationId, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, setupConnectErrorHandler, setupExpressErrorHandler, setupHapiErrorHandler, setupHonoErrorHandler, setupKoaErrorHandler, spanStreamingIntegration, spanToBaggageHeader, spanToJSON, spanToTraceHeader, spotlightIntegration, startInactiveSpan, startNewTrace, startSession, startSpan, startSpanManual, statsigIntegration, supabaseIntegration, suppressTracing, systemErrorIntegration, tediousIntegration, trpcMiddleware, unleashIntegration, updateSpanName, vercelAIIntegration, winterCGHeadersToDict, withActiveSpan, withIsolationScope, withMonitor, withScope, withStreamedSpan, wrapMcpServerWithSentry, zodErrorsIntegration } from '@sentry/node';
1
+ export { NODE_VERSION, NodeClient, OpenFeatureIntegrationHook, SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, amqplibIntegration, anrIntegration, anthropicAIIntegration, bindScopeToEmitter, buildLaunchDarklyFlagUsedHandler, captureCheckIn, captureEvent, captureException, captureFeedback, captureMessage, captureSession, childProcessIntegration, close, consoleIntegration, consoleLoggingIntegration, contextLinesIntegration, continueTrace, createConsolaReporter, createGetModuleFromFilename, createLangChainCallbackHandler, createSentryWinstonTransport, createTransport, cron, dataloaderIntegration, defaultStackParser, disableAnrDetectionForCallback, endSession, eventFiltersIntegration, expressErrorHandler, expressIntegration, fastifyIntegration, featureFlagsIntegration, firebaseIntegration, flush, fsIntegration, functionToStringIntegration, genericPoolIntegration, getActiveSpan, getAutoPerformanceIntegrations, getClient, getCurrentScope, getGlobalScope, getIsolationScope, getOtlpTracesEndpoint, getRootSpan, getSentryRelease, getSpanDescendants, getSpanStatusFromHttpCode, getTraceData, getTraceMetaTags, googleGenAIIntegration, graphqlIntegration, growthbookIntegration, hapiIntegration, httpHeadersToSpanAttributes, httpIntegration, httpServerIntegration, httpServerSpansIntegration, initOpenTelemetry, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, instrumentLangChainEmbeddings, instrumentOpenAiClient, instrumentStateGraph, instrumentStateGraphCompile, instrumentSupabaseClient, isEnabled, isInitialized, kafkaIntegration, knexIntegration, koaIntegration, langChainIntegration, langGraphIntegration, lastEventId, launchDarklyIntegration, linkedErrorsIntegration, localVariablesIntegration, logger, lruMemoizerIntegration, makeNodeTransport, metrics, modulesIntegration, mongoIntegration, mongooseIntegration, mysql2Integration, mysqlIntegration, nativeNodeFetchIntegration, nodeContextIntegration, nodeRuntimeMetricsIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, openAIIntegration, openFeatureIntegration, otlpIntegration, parameterize, pinoIntegration, postgresIntegration, postgresJsIntegration, prismaIntegration, processSessionIntegration, profiler, redisIntegration, requestDataIntegration, setAttribute, setAttributes, setContext, setConversationId, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, setupExpressErrorHandler, setupHapiErrorHandler, setupKoaErrorHandler, spanStreamingIntegration, spanToBaggageHeader, spanToJSON, spanToStaticSpanJSON, spanToTraceHeader, spotlightIntegration, startInactiveSpan, startNewTrace, startSession, startSpan, startSpanManual, statsigIntegration, supabaseIntegration, suppressTracing, systemErrorIntegration, tediousIntegration, trpcMiddleware, unleashIntegration, updateSpanName, vercelAIIntegration, winterCGHeadersToDict, withActiveSpan, withIsolationScope, withMonitor, withScope, withStaticSpan, withStreamedSpan, wrapMcpServerWithSentry, zodErrorsIntegration } from '@sentry/node';
2
2
  export { captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration } from '@sentry/core';
3
3
  export { getDefaultIntegrations, init } from './sdk.js';
4
4
  export { googleCloudHttpIntegration } from './integrations/google-cloud-http.js';
@@ -1,3 +1,5 @@
1
+ import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
2
+ import { FAAS_GRPC_SPAN_OP } from '@sentry/conventions/op';
1
3
  import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
2
4
  import { startInactiveSpan } from '@sentry/node';
3
5
 
@@ -63,9 +65,12 @@ function fillGrpcFunction(stub, serviceIdentifier, methodName) {
63
65
  const span = startInactiveSpan({
64
66
  name: `${callType} ${methodName}`,
65
67
  onlyIfParent: true,
66
- op: `grpc.${serviceIdentifier}`,
67
68
  attributes: {
68
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.grpc.serverless"
69
+ [SENTRY_OP]: FAAS_GRPC_SPAN_OP,
70
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.grpc.serverless",
71
+ [RPC_SYSTEM_NAME]: "grpc",
72
+ [RPC_SERVICE]: serviceIdentifier,
73
+ [RPC_METHOD]: methodName
69
74
  }
70
75
  });
71
76
  ret.on("status", () => {
@@ -1 +1 @@
1
- {"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface 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\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc' as const;\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 */\nexport function 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?.[1] || servicePath;\n}\n"],"names":[],"mappings":";;;AA2BA,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA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,MACF,CAAC,CAAA;AACD,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACJ;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;"}
1
+ {"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { FAAS_GRPC_SPAN_OP } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface 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\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc' as const;\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 */\nexport function 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 attributes: {\n [SENTRY_OP]: FAAS_GRPC_SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',\n [RPC_SYSTEM_NAME]: 'grpc',\n [RPC_SERVICE]: serviceIdentifier,\n [RPC_METHOD]: methodName,\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?.[1] || servicePath;\n}\n"],"names":[],"mappings":";;;;;AA6BA,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,IAAI;AAEF,QAAA,MAAM,SAAA,GAAY,QAAQ,YAAY,CAAA;AACtC,QAAA,IAAA;AAAA,UACE,UAAU,UAAA,CAAW,SAAA;AAAA;AAAA,UACrB,YAAA;AAAA,UACA;AAAA,SACF;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,CAAC,QAAA,EAAU;AACb,UAAA,MAAM,CAAA;AAAA,QACR;AAAA,MACF;AAAA,IACF,CAAA;AAAA,IACA,MAAM,MAAA,EAAQ;AACZ,MAAA,aAAA,CAAc,GAAA,CAAI,QAAQ,IAAI,CAAA;AAAA,IAChC;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,0BAAA,GAA6B,kBAAkB,2BAA2B;AAGvF,SAAS,eAAe,UAAA,EAA4C;AAClE,EAAA,OAAO,kBAAkC,IAAA,EAAkC;AACzE,IAAA,MAAM,WAAA,GAAc,IAAA,CAAK,CAAC,CAAA,EAAG,WAAA;AAC7B,IAAA,IAAI,WAAA,IAAe,IAAA,IAAQ,WAAA,IAAe,MAAA,EAAW;AACnD,MAAA,OAAO,UAAA,CAAW,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AAAA,IACpC;AACA,IAAA,MAAM,iBAAA,GAAoB,gBAAgB,WAAW,CAAA;AACrD,IA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AAA,UACV,CAAC,SAAS,GAAG,iBAAA;AAAA,UACb,CAAC,gCAAgC,GAAG,sBAAA;AAAA,UACpC,CAAC,eAAe,GAAG,MAAA;AAAA,UACnB,CAAC,WAAW,GAAG,iBAAA;AAAA,UACf,CAAC,UAAU,GAAG;AAAA;AAChB,OACD,CAAA;AACD,MAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,IAAA,CAAK,GAAA,EAAI;AAAA,QACX;AAAA,MACF,CAAC,CAAA;AACD,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACJ;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;"}
@@ -1,4 +1,6 @@
1
- import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan } from '@sentry/core';
1
+ import { URL_FULL, SERVER_ADDRESS, HTTP_REQUEST_METHOD, SENTRY_OP } from '@sentry/conventions/attributes';
2
+ import { WEB_SERVER_HTTP_CLIENT_SPAN_OP } from '@sentry/conventions/op';
3
+ import { defineIntegration, fill, getClient, filterCollectedUrl, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, stripUrlQueryAndFragment, SentryNonRecordingSpan, parseStringToURLObject, isURLObjectRelative } from '@sentry/core';
2
4
  import { startInactiveSpan } from '@sentry/node';
3
5
 
4
6
  const INTEGRATION_NAME = "GoogleCloudHttp";
@@ -27,11 +29,15 @@ function wrapRequestFunction(orig) {
27
29
  return function(reqOpts, callback) {
28
30
  const httpMethod = reqOpts.method || "GET";
29
31
  const span = SETUP_CLIENTS.has(getClient()) ? startInactiveSpan({
30
- name: `${httpMethod} ${reqOpts.uri}`,
32
+ // Span names must not contain a query string, and callers can pass any URI they want.
33
+ name: `${httpMethod} ${stripUrlQueryAndFragment(reqOpts.uri)}`,
31
34
  onlyIfParent: true,
32
- op: `http.client.${identifyService(this.apiEndpoint)}`,
33
35
  attributes: {
34
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.serverless"
36
+ [SENTRY_OP]: WEB_SERVER_HTTP_CLIENT_SPAN_OP,
37
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.serverless",
38
+ [HTTP_REQUEST_METHOD]: httpMethod,
39
+ [SERVER_ADDRESS]: getServerAddress(this.apiEndpoint),
40
+ [URL_FULL]: filterCollectedUrl(reqOpts.uri)
35
41
  }
36
42
  }) : new SentryNonRecordingSpan();
37
43
  orig.call(this, reqOpts, (...args) => {
@@ -40,9 +46,9 @@ function wrapRequestFunction(orig) {
40
46
  });
41
47
  };
42
48
  }
43
- function identifyService(apiEndpoint) {
44
- const match = apiEndpoint.match(/^https:\/\/(\w+)\.googleapis.com$/);
45
- return match?.[1] || apiEndpoint.replace(/^(http|https)?:\/\//, "");
49
+ function getServerAddress(apiEndpoint) {
50
+ const url = parseStringToURLObject(apiEndpoint);
51
+ return url && !isURLObjectRelative(url) ? url.host : apiEndpoint;
46
52
  }
47
53
 
48
54
  export { googleCloudHttpIntegration };
@@ -1 +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 type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\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' as const;\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?.[1] || apiEndpoint.replace(/^(http|https)?:\\/\\//, '');\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAA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I,CAAA;AAAA,IAClB,CAAC,CAAA;AAAA,EACH,CAAA;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,mCAAmC,CAAA;AACnE,EAAA,OAAO,QAAQ,CAAC,CAAA,IAAK,WAAA,CAAY,OAAA,CAAQ,uBAAuB,EAAE,CAAA;AACpE;;;;"}
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 { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_FULL } from '@sentry/conventions/attributes';\nimport { WEB_SERVER_HTTP_CLIENT_SPAN_OP } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n isURLObjectRelative,\n parseStringToURLObject,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n filterCollectedUrl,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\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' as const;\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 // Span names must not contain a query string, and callers can pass any URI they want.\n name: `${httpMethod} ${stripUrlQueryAndFragment(reqOpts.uri)}`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: WEB_SERVER_HTTP_CLIENT_SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n [HTTP_REQUEST_METHOD]: httpMethod,\n [SERVER_ADDRESS]: getServerAddress(this.apiEndpoint),\n [URL_FULL]: filterCollectedUrl(reqOpts.uri),\n },\n })\n : new SentryNonRecordingSpan();\n orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {\n span.end();\n callback(...args);\n });\n };\n}\n\n/** Extracts the host of the API endpoint the request is sent to */\nfunction getServerAddress(apiEndpoint: string): string {\n const url = parseStringToURLObject(apiEndpoint);\n return url && !isURLObjectRelative(url) ? url.host : apiEndpoint;\n}\n"],"names":[],"mappings":";;;;;AAwBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,IAAI;AAEF,QAAA,MAAM,YAAA,GAAe,QAAQ,sBAAsB,CAAA;AACnD,QAAA,IAAA,CAAK,YAAA,CA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AiB,WAAA,EAA6B;AACrD,EAAA,MAAM,GAAA,GAAM,uBAAuB,WAAW,CAAA;AAC9C,EAAA,OAAO,OAAO,CAAC,mBAAA,CAAoB,GAAG,CAAA,GAAI,IAAI,IAAA,GAAO,WAAA;AACvD;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.70.0","sideEffects":false}
1
+ {"type":"module","version":"11.0.0-alpha.1","sideEffects":false}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { getDefaultIntegrationsWithoutPerformance, init as initNode } from '@sentry/node';\nimport { gcpContextIntegration } from './integrations/gcp-context';\nimport { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';\nimport { googleCloudHttpIntegration } from './integrations/google-cloud-http';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n /*! rollup-include-cjs-only */\n return [\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 /*! rollup-include-cjs-only-end */\n /*! rollup-include-esm-only */\n return [];\n /*! rollup-include-esm-only-end */\n}\n\n/** Get the default integrations for the GCP SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n return [...getDefaultIntegrationsWithoutPerformance(), gcpContextIntegration(), ...getCjsOnlyIntegrations()];\n}\n\n/**\n * @see {@link Sentry.init}\n */\nexport function init(options: NodeOptions = {}): NodeClient | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'google-cloud-serverless', ['google-cloud-serverless', 'node']);\n\n return initNode(opts);\n}\n"],"names":["initNode"],"mappings":";;;;;;AAQA,SAAS,sBAAA,GAAwC;AAAA,EAC/C,OAAA,EAAA;AACA;AACE,SAAA,sBAA6B,CAAA,QAAU,EAAM;AAAA,EAAA,OAAA,CAAA,GAAA,wCAAA,EAAA,EAAA,qBAAA,EAAA,EAAA,GAAA,sBAAA,EAAA,CAAA;AAAA;AACA,SAAA,IAAA,CAAA,OAAA,GAAA,EAAA,EAAA;AAAA,EAC/C,MAAA,IAAA,GAAA;AAAA,IACA,mBAAA,EAAA,sBAAA,CAAA,CAAA;AAAA,IACA,GAAA;AACA,GAAA;AAAQ,EACR,gBAAA,CAAA,IAAA,EAAA,yBAAA,EAAA,CAAA,yBAAA,EAAA,MAAA,CAAA,CAAA;AACF,EAAA,OAAAA,MAAA,CAAA,IAAA,CAAA;AAGO;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { getDefaultIntegrationsWithoutPerformance, init as initNode } from '@sentry/node';\nimport { gcpContextIntegration } from './integrations/gcp-context';\nimport { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';\nimport { googleCloudHttpIntegration } from './integrations/google-cloud-http';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n /*! rollup-include-cjs-only */\n return [\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 /*! rollup-include-cjs-only-end */\n /*! rollup-include-esm-only */\n // oxlint-disable-next-line no-unreachable -- reachable only in the ESM build; rollup strips the CJS return above\n return [];\n /*! rollup-include-esm-only-end */\n}\n\n/** Get the default integrations for the GCP SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n return [...getDefaultIntegrationsWithoutPerformance(), gcpContextIntegration(), ...getCjsOnlyIntegrations()];\n}\n\n/**\n * @see {@link Sentry.init}\n */\nexport function init(options: NodeOptions = {}): NodeClient | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'google-cloud-serverless', ['google-cloud-serverless', 'node']);\n\n return initNode(opts);\n}\n"],"names":["initNode"],"mappings":";;;;;;AAQA,SAAS,sBAAA,GAAwC;AAAA,EAC/C,OAAA,EAAA;AACA;AACE,SAAA,sBAA6B,CAAA,QAAU,EAAM;AAAA,EAAA,OAAA,CAAA,GAAA,wCAAA,EAAA,EAAA,qBAAA,EAAA,EAAA,GAAA,sBAAA,EAAA,CAAA;AAAA;AACA,SAAA,IAAA,CAAA,OAAA,GAAA,EAAA,EAAA;AAAA,EAC/C,MAAA,IAAA,GAAA;AAAA,IACA,mBAAA,EAAA,sBAAA,CAAA,CAAA;AAAA,IACA,GAAA;AAEA,GAAA;AAAQ,EACR,gBAAA,CAAA,IAAA,EAAA,yBAAA,EAAA,CAAA,yBAAA,EAAA,MAAA,CAAA,CAAA;AACF,EAAA,OAAAA,MAAA,CAAA,IAAA,CAAA;AAGO;;;;"}
@@ -1 +1 @@
1
- export { getFormat, getSource, load, resolve } from '@sentry/node/loader-hook';
1
+ import '@sentry/server-utils/orchestrion/import-hook';
@@ -1 +1 @@
1
- {"version":3,"file":"cloud_events.d.ts","sourceRoot":"","sources":["../../../src/gcpfunction/cloud_events.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpG,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,kBAAkB,GAAG,8BAA8B,EACvD,WAAW,GAAE,OAAO,CAAC,gCAAgC,CAAM,GAC1D,8BAA8B,CAEhC"}
1
+ {"version":3,"file":"cloud_events.d.ts","sourceRoot":"","sources":["../../../src/gcpfunction/cloud_events.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEpG,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,kBAAkB,GAAG,8BAA8B,EACvD,WAAW,GAAE,OAAO,CAAC,gCAAgC,CAAM,GAC1D,8BAA8B,CAEhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/gcpfunction/events.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE1F,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,aAAa,GAAG,yBAAyB,EAC7C,WAAW,GAAE,OAAO,CAAC,2BAA2B,CAAM,GACrD,yBAAyB,CAE3B"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/gcpfunction/events.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE1F,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,aAAa,GAAG,yBAAyB,EAC7C,WAAW,GAAE,OAAO,CAAC,2BAA2B,CAAM,GACrD,yBAAyB,CAE3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/gcpfunction/http.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,EAAE,WAAW,GAAE,OAAO,CAAC,cAAc,CAAM,GAAG,YAAY,CAY1G"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/gcpfunction/http.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,EAAE,WAAW,GAAE,OAAO,CAAC,cAAc,CAAM,GAAG,YAAY,CAY1G"}
@@ -1,4 +1,4 @@
1
- export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureCheckIn, captureFeedback, startSession, captureSession, endSession, withMonitor, createTransport, getClient, isInitialized, isEnabled, generateInstrumentOnce, getCurrentScope, getGlobalScope, getIsolationScope, getTraceData, getTraceMetaTags, setCurrentClient, Scope, SDK_VERSION, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, makeNodeTransport, NodeClient, defaultStackParser, lastEventId, flush, close, getSentryRelease, createGetModuleFromFilename, createLangChainCallbackHandler, instrumentLangChainEmbeddings, httpHeadersToSpanAttributes, winterCGHeadersToDict, anrIntegration, disableAnrDetectionForCallback, consoleIntegration, httpIntegration, httpServerIntegration, httpServerSpansIntegration, nativeNodeFetchIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, openAIIntegration, langChainIntegration, langGraphIntegration, modulesIntegration, nodeRuntimeMetricsIntegration, type NodeRuntimeMetricsOptions, contextLinesIntegration, nodeContextIntegration, localVariablesIntegration, requestDataIntegration, fsIntegration, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, setMeasurement, getActiveSpan, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getRootSpan, getSpanDescendants, continueTrace, getAutoPerformanceIntegrations, cron, parameterize, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, expressIntegration, expressErrorHandler, setupExpressErrorHandler, koaIntegration, setupKoaErrorHandler, connectIntegration, setupConnectErrorHandler, fastifyIntegration, firebaseIntegration, genericPoolIntegration, graphqlIntegration, knexIntegration, kafkaIntegration, lruMemoizerIntegration, mongoIntegration, mongooseIntegration, mysqlIntegration, mysql2Integration, redisIntegration, tediousIntegration, pinoIntegration, postgresIntegration, postgresJsIntegration, prismaIntegration, processSessionIntegration, hapiIntegration, setupHapiErrorHandler, honoIntegration, setupHonoErrorHandler, spotlightIntegration, initOpenTelemetry, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, systemErrorIntegration, instrumentSupabaseClient, instrumentOpenAiClient, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, instrumentStateGraph, instrumentLangGraph, instrumentStateGraphCompile, zodErrorsIntegration, profiler, amqplibIntegration, anthropicAIIntegration, googleGenAIIntegration, childProcessIntegration, createSentryWinstonTransport, vercelAIIntegration, logger, consoleLoggingIntegration, createConsolaReporter, wrapMcpServerWithSentry, NODE_VERSION, featureFlagsIntegration, type FeatureFlagsIntegration, launchDarklyIntegration, growthbookIntegration, buildLaunchDarklyFlagUsedHandler, openFeatureIntegration, OpenFeatureIntegrationHook, statsigIntegration, unleashIntegration, metrics, spanStreamingIntegration, withStreamedSpan, } from '@sentry/node';
1
+ export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureCheckIn, captureFeedback, startSession, captureSession, endSession, withMonitor, createTransport, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, getTraceData, getTraceMetaTags, setCurrentClient, Scope, SDK_VERSION, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, makeNodeTransport, NodeClient, defaultStackParser, lastEventId, flush, close, getSentryRelease, createGetModuleFromFilename, createLangChainCallbackHandler, instrumentLangChainEmbeddings, httpHeadersToSpanAttributes, winterCGHeadersToDict, anrIntegration, disableAnrDetectionForCallback, consoleIntegration, httpIntegration, httpServerIntegration, httpServerSpansIntegration, nativeNodeFetchIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, openAIIntegration, langChainIntegration, langGraphIntegration, modulesIntegration, nodeRuntimeMetricsIntegration, type NodeRuntimeMetricsOptions, contextLinesIntegration, nodeContextIntegration, localVariablesIntegration, requestDataIntegration, fsIntegration, functionToStringIntegration, eventFiltersIntegration, linkedErrorsIntegration, setMeasurement, getActiveSpan, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getRootSpan, getSpanDescendants, continueTrace, getAutoPerformanceIntegrations, cron, parameterize, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, expressIntegration, expressErrorHandler, setupExpressErrorHandler, koaIntegration, setupKoaErrorHandler, fastifyIntegration, firebaseIntegration, genericPoolIntegration, graphqlIntegration, knexIntegration, kafkaIntegration, lruMemoizerIntegration, mongoIntegration, mongooseIntegration, mysqlIntegration, mysql2Integration, redisIntegration, tediousIntegration, pinoIntegration, postgresIntegration, postgresJsIntegration, prismaIntegration, otlpIntegration, getOtlpTracesEndpoint, processSessionIntegration, hapiIntegration, setupHapiErrorHandler, spotlightIntegration, initOpenTelemetry, spanToStaticSpanJSON, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, systemErrorIntegration, instrumentSupabaseClient, instrumentOpenAiClient, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, instrumentStateGraph, instrumentStateGraphCompile, zodErrorsIntegration, profiler, amqplibIntegration, anthropicAIIntegration, googleGenAIIntegration, childProcessIntegration, createSentryWinstonTransport, vercelAIIntegration, logger, consoleLoggingIntegration, createConsolaReporter, wrapMcpServerWithSentry, NODE_VERSION, featureFlagsIntegration, type FeatureFlagsIntegration, launchDarklyIntegration, growthbookIntegration, buildLaunchDarklyFlagUsedHandler, openFeatureIntegration, OpenFeatureIntegrationHook, statsigIntegration, unleashIntegration, metrics, spanStreamingIntegration, withStaticSpan, withStreamedSpan, } from '@sentry/node';
2
2
  export { captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, } from '@sentry/core';
3
3
  export { getDefaultIntegrations, init } from './sdk';
4
4
  export { googleCloudHttpIntegration } from './integrations/google-cloud-http';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,UAAU,EACV,WAAW,EACX,eAAe,EACf,SAAS,EACT,aAAa,EACb,SAAS,EACT,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,YAAY,EACZ,aAAa,EACb,OAAO,EACP,yBAAyB,EACzB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,8BAA8B,EAC9B,6BAA6B,EAC7B,2BAA2B,EAC3B,qBAAqB,EAErB,cAAc,EAEd,8BAA8B,EAC9B,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACr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EACtB,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,MAAM,EACN,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,UAAU,EACV,WAAW,EACX,eAAe,EACf,SAAS,EACT,aAAa,EACb,SAAS,EACT,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,YAAY,EACZ,aAAa,EACb,OAAO,EACP,yBAAyB,EACzB,aAAa,EACb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ACnB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,MAAM,EACN,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,qBAAqB,EACrB,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,wBAAwB,EACxB,cAAc,EAEd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"google-cloud-grpc.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-grpc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;CACpC;AAED,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD,MAAM,WAAW,IAAI;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACnC;AAiCD;;GAEG;AACH,eAAO,MAAM,0BAA0B;eA5BqB,OAAO;;;CA4BqB,CAAC;AAkBzF,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAyChG"}
1
+ {"version":3,"file":"google-cloud-grpc.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-grpc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;CACpC;AAED,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD,MAAM,WAAW,IAAI;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACnC;AAiCD;;GAEG;AACH,eAAO,MAAM,0BAA0B;eA5BqB,OAAO;;;CA4BqB,CAAC;AAkBzF,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CA4ChG"}
@@ -1 +1 @@
1
- {"version":3,"file":"google-cloud-http.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-http.ts"],"names":[],"mappings":"AA2CA;;GAEG;AACH,eAAO,MAAM,0BAA0B;eAxBqB,OAAO;;;CAwBqB,CAAC"}
1
+ {"version":3,"file":"google-cloud-http.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-http.ts"],"names":[],"mappings":"AAiDA;;GAEG;AACH,eAAO,MAAM,0BAA0B;eAxBqB,OAAO;;;CAwBqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAkB5D,oDAAoD;AACpD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,EAAE,CAEvE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,UAAU,GAAG,SAAS,CAStE"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAmB5D,oDAAoD;AACpD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,EAAE,CAEvE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,UAAU,GAAG,SAAS,CAStE"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@sentry/google-cloud-serverless",
3
- "version": "10.70.0",
3
+ "version": "11.0.0-alpha.1",
4
4
  "description": "Official Sentry SDK for Google Cloud Functions",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/google-cloud-serverless",
7
7
  "author": "Sentry",
8
8
  "license": "MIT",
9
9
  "engines": {
10
- "node": ">=18"
10
+ "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0"
11
11
  },
12
12
  "files": [
13
13
  "/build"
@@ -30,34 +30,23 @@
30
30
  "import": {
31
31
  "default": "./build/import-hook.mjs"
32
32
  }
33
- },
34
- "./loader": {
35
- "import": {
36
- "default": "./build/loader-hook.mjs"
37
- }
38
- }
39
- },
40
- "typesVersions": {
41
- "<5.0": {
42
- "build/types/index.d.ts": [
43
- "build/types-ts3.8/index.d.ts"
44
- ]
45
33
  }
46
34
  },
47
35
  "publishConfig": {
48
36
  "access": "public"
49
37
  },
50
38
  "dependencies": {
51
- "@sentry/core": "10.70.0",
52
- "@sentry/node": "10.70.0",
53
- "@sentry/node-core": "10.70.0"
39
+ "@sentry/conventions": "^0.19.0",
40
+ "@sentry/core": "11.0.0-alpha.1",
41
+ "@sentry/node": "11.0.0-alpha.1",
42
+ "@sentry/server-utils": "11.0.0-alpha.1"
54
43
  },
55
44
  "devDependencies": {
56
45
  "@google-cloud/bigquery": "^5.3.0",
57
46
  "@google-cloud/common": "^3.4.1",
58
47
  "@types/express": "^5.0.6",
59
48
  "@types/node": "^18.19.1",
60
- "nock": "^14.0.16"
49
+ "nock": "^14.0.17"
61
50
  },
62
51
  "peerDependencies": {
63
52
  "@types/express": "^4.17.14 || ^5.x"
@@ -71,17 +60,15 @@
71
60
  "build": "run-p build:transpile build:types",
72
61
  "build:dev": "yarn build",
73
62
  "build:transpile": "rollup -c rollup.npm.config.mjs",
74
- "build:types": "run-s build:types:core build:types:downlevel",
75
- "build:types:core": "tsc -p tsconfig.types.json",
76
- "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
63
+ "build:types": "tsc -p tsconfig.types.json",
77
64
  "build:watch": "run-p build:transpile:watch",
78
65
  "build:dev:watch": "yarn build:watch",
79
66
  "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
80
67
  "build:tarball": "npm pack",
81
68
  "circularDepCheck": "madge --circular src/index.ts",
82
69
  "clean": "rimraf build coverage sentry-google-cloud-*.tgz",
83
- "lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix --type-aware",
84
- "lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --type-aware",
70
+ "lint:fix": "oxlint . --fix --type-aware",
71
+ "lint": "oxlint . --type-aware",
85
72
  "lint:es-compatibility": "es-check es2022 ./build/cjs/*.js && es-check es2022 ./build/esm/*.js --module",
86
73
  "test": "vitest run",
87
74
  "test:watch": "vitest --watch",
@@ -1 +0,0 @@
1
- import '@sentry/node/import-hook';
@@ -1,7 +0,0 @@
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
- export declare const DEBUG_BUILD: boolean;
7
- //# sourceMappingURL=debug-build.d.ts.map
@@ -1,11 +0,0 @@
1
- import { CloudEventFunction, CloudEventFunctionWithCallback, WrapperOptions } from './general';
2
- export type CloudEventFunctionWrapperOptions = WrapperOptions;
3
- /**
4
- * Wraps an event function handler adding it error capture and tracing capabilities.
5
- *
6
- * @param fn Event handler
7
- * @param options Options
8
- * @returns Event handler
9
- */
10
- export declare function wrapCloudEventFunction(fn: CloudEventFunction | CloudEventFunctionWithCallback, wrapOptions?: Partial<CloudEventFunctionWrapperOptions>): CloudEventFunctionWithCallback;
11
- //# sourceMappingURL=cloud_events.d.ts.map
@@ -1,11 +0,0 @@
1
- import { EventFunction, EventFunctionWithCallback, WrapperOptions } from './general';
2
- export type EventFunctionWrapperOptions = WrapperOptions;
3
- /**
4
- * Wraps an event function handler adding it error capture and tracing capabilities.
5
- *
6
- * @param fn Event handler
7
- * @param options Options
8
- * @returns Event handler
9
- */
10
- export declare function wrapEventFunction(fn: EventFunction | EventFunctionWithCallback, wrapOptions?: Partial<EventFunctionWrapperOptions>): EventFunctionWithCallback;
11
- //# sourceMappingURL=events.d.ts.map
@@ -1,38 +0,0 @@
1
- import { Request, Response } from 'express';
2
- export interface HttpFunction {
3
- (req: Request, res: Response): any;
4
- }
5
- export interface EventFunction {
6
- (data: Record<string, any>, context: Context): any;
7
- }
8
- export interface EventFunctionWithCallback {
9
- (data: Record<string, any>, context: Context, callback: Function): any;
10
- }
11
- export interface CloudEventFunction {
12
- (cloudevent: CloudEventsContext): any;
13
- }
14
- export interface CloudEventFunctionWithCallback {
15
- (cloudevent: CloudEventsContext, callback: Function): any;
16
- }
17
- export interface CloudFunctionsContext {
18
- eventId?: string;
19
- timestamp?: string;
20
- eventType?: string;
21
- resource?: string;
22
- }
23
- export interface CloudEventsContext {
24
- [key: string]: any;
25
- id: string;
26
- specversion: string;
27
- type: string;
28
- source: string;
29
- time?: string;
30
- schemaurl?: string;
31
- contenttype?: string;
32
- }
33
- export type Context = CloudFunctionsContext | CloudEventsContext;
34
- export interface WrapperOptions {
35
- flushTimeout: number;
36
- }
37
- export { Request, Response };
38
- //# sourceMappingURL=general.d.ts.map
@@ -1,10 +0,0 @@
1
- import { HttpFunction, WrapperOptions } from './general';
2
- /**
3
- * Wraps an HTTP function handler adding it error capture and tracing capabilities.
4
- *
5
- * @param fn HTTP Handler
6
- * @param options Options
7
- * @returns HTTP handler
8
- */
9
- export declare function wrapHttpFunction(fn: HttpFunction, wrapOptions?: Partial<WrapperOptions>): HttpFunction;
10
- //# sourceMappingURL=http.d.ts.map
@@ -1,9 +0,0 @@
1
- export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureCheckIn, captureFeedback, startSession, captureSession, endSession, withMonitor, createTransport, getClient, isInitialized, isEnabled, generateInstrumentOnce, getCurrentScope, getGlobalScope, getIsolationScope, getTraceData, getTraceMetaTags, setCurrentClient, Scope, SDK_VERSION, setContext, setConversationId, setExtra, setExtras, setTag, setTags, setAttribute, setAttributes, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, makeNodeTransport, NodeClient, defaultStackParser, lastEventId, flush, close, getSentryRelease, createGetModuleFromFilename, createLangChainCallbackHandler, instrumentLangChainEmbeddings, httpHeadersToSpanAttributes, winterCGHeadersToDict, anrIntegration, disableAnrDetectionForCallback, consoleIntegration, httpIntegration, httpServerIntegration, httpServerSpansIntegration, nativeNodeFetchIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, openAIIntegration, langChainIntegration, langGraphIntegration, modulesIntegration, nodeRuntimeMetricsIntegration, NodeRuntimeMetricsOptions, contextLinesIntegration, nodeContextIntegration, localVariablesIntegration, requestDataIntegration, fsIntegration, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, setMeasurement, getActiveSpan, startSpan, startInactiveSpan, startSpanManual, startNewTrace, bindScopeToEmitter, suppressTracing, withActiveSpan, getRootSpan, getSpanDescendants, continueTrace, getAutoPerformanceIntegrations, cron, parameterize, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, dataloaderIntegration, expressIntegration, expressErrorHandler, setupExpressErrorHandler, koaIntegration, setupKoaErrorHandler, connectIntegration, setupConnectErrorHandler, fastifyIntegration, firebaseIntegration, genericPoolIntegration, graphqlIntegration, knexIntegration, kafkaIntegration, lruMemoizerIntegration, mongoIntegration, mongooseIntegration, mysqlIntegration, mysql2Integration, redisIntegration, tediousIntegration, pinoIntegration, postgresIntegration, postgresJsIntegration, prismaIntegration, processSessionIntegration, hapiIntegration, setupHapiErrorHandler, honoIntegration, setupHonoErrorHandler, spotlightIntegration, initOpenTelemetry, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, systemErrorIntegration, instrumentSupabaseClient, instrumentOpenAiClient, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, instrumentStateGraph, instrumentLangGraph, instrumentStateGraphCompile, zodErrorsIntegration, profiler, amqplibIntegration, anthropicAIIntegration, googleGenAIIntegration, childProcessIntegration, createSentryWinstonTransport, vercelAIIntegration, logger, consoleLoggingIntegration, createConsolaReporter, wrapMcpServerWithSentry, NODE_VERSION, featureFlagsIntegration, FeatureFlagsIntegration, launchDarklyIntegration, growthbookIntegration, buildLaunchDarklyFlagUsedHandler, openFeatureIntegration, OpenFeatureIntegrationHook, statsigIntegration, unleashIntegration, metrics, spanStreamingIntegration, withStreamedSpan } from '@sentry/node';
2
- export { captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, } from '@sentry/core';
3
- export { getDefaultIntegrations, init } from './sdk';
4
- export { googleCloudHttpIntegration } from './integrations/google-cloud-http';
5
- export { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';
6
- export { wrapCloudEventFunction } from './gcpfunction/cloud_events';
7
- export { wrapHttpFunction } from './gcpfunction/http';
8
- export { wrapEventFunction } from './gcpfunction/events';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +0,0 @@
1
- export declare const gcpContextIntegration: () => import("@sentry/core").Integration & {
2
- name: "GcpContext";
3
- };
4
- //# sourceMappingURL=gcp-context.d.ts.map
@@ -1,23 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- export interface GrpcFunction extends CallableFunction {
3
- (...args: unknown[]): EventEmitter;
4
- }
5
- export interface GrpcFunctionObject extends GrpcFunction {
6
- requestStream: boolean;
7
- responseStream: boolean;
8
- originalName: string;
9
- }
10
- export interface Stub {
11
- [key: string]: GrpcFunctionObject;
12
- }
13
- /**
14
- * Google Cloud Platform service requests tracking for GRPC APIs.
15
- */
16
- export declare const googleCloudGrpcIntegration: (options?: {
17
- optional?: boolean;
18
- } | undefined) => import("@sentry/core").Integration & {
19
- name: "GoogleCloudGrpc";
20
- };
21
- /** Patches the function in grpc stub to enable tracing */
22
- export declare function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void;
23
- //# sourceMappingURL=google-cloud-grpc.d.ts.map
@@ -1,9 +0,0 @@
1
- /**
2
- * Google Cloud Platform service requests tracking for RESTful APIs.
3
- */
4
- export declare const googleCloudHttpIntegration: (options?: {
5
- optional?: boolean;
6
- } | undefined) => import("@sentry/core").Integration & {
7
- name: "GoogleCloudHttp";
8
- };
9
- //# sourceMappingURL=google-cloud-http.d.ts.map
@@ -1,9 +0,0 @@
1
- import { Integration, Options } from '@sentry/core';
2
- import { NodeClient, NodeOptions } from '@sentry/node';
3
- /** Get the default integrations for the GCP SDK. */
4
- export declare function getDefaultIntegrations(_options: Options): Integration[];
5
- /**
6
- * @see {@link Sentry.init}
7
- */
8
- export declare function init(options?: NodeOptions): NodeClient | undefined;
9
- //# sourceMappingURL=sdk.d.ts.map
@@ -1,18 +0,0 @@
1
- import { Scope } from '@sentry/core';
2
- /**
3
- * @param fn function to run
4
- * @returns function which runs in the newly created domain or in the existing one
5
- */
6
- export declare function domainify<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R | void;
7
- /**
8
- * @param source function to be wrapped
9
- * @param wrap wrapping function that takes source and returns a wrapper
10
- * @param overrides properties to override in the source
11
- * @returns wrapped function
12
- */
13
- export declare function proxyFunction<A extends any[], R, F extends (...args: A) => R>(source: F, wrap: (source: F) => F, overrides?: Record<PropertyKey, unknown>): F;
14
- /**
15
- * Marks an event as unhandled by adding a span processor to the passed scope.
16
- */
17
- export declare function markEventUnhandled(scope: Scope, type: string): Scope;
18
- //# sourceMappingURL=utils.d.ts.map