@sentry/google-cloud-serverless 11.3.0 → 11.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,7 @@ function _wrapCloudEventFunction(fn, wrapOptions = {}) {
27
27
  [attributes.FAAS_NAME]: functionName,
28
28
  [attributes.FAAS_TRIGGER]: "cloud_event",
29
29
  [attributes.SENTRY_SEGMENT_NAME_SOURCE]: "component",
30
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_cloud_event",
30
+ [attributes.SENTRY_ORIGIN]: "auto.function.serverless.gcp_cloud_event",
31
31
  [attributes.GCP_FUNCTION_CONTEXT_TYPE]: context.type,
32
32
  [attributes.GCP_FUNCTION_CONTEXT_ID]: context.id,
33
33
  [attributes.GCP_FUNCTION_CONTEXT_SOURCE]: context.source,
@@ -1 +1 @@
1
- {"version":3,"file":"cloud_events.js","sources":["../../../src/gcpfunction/cloud_events.ts"],"sourcesContent":["import {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n SENTRY_OP,\n GCP_FUNCTION_CONTEXT_TYPE,\n GCP_FUNCTION_CONTEXT_ID,\n GCP_FUNCTION_CONTEXT_SOURCE,\n GCP_FUNCTION_CONTEXT_SPECVERSION,\n GCP_FUNCTION_CONTEXT_TIME,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, getFunctionName, 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 const client = getClient();\n\n const functionName = getFunctionName();\n const name =\n client && hasSpanStreamingEnabled(client)\n ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK\n : context.type || '<unknown>';\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'cloud_event',\n [SENTRY_SEGMENT_NAME_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event',\n [GCP_FUNCTION_CONTEXT_TYPE]: context.type,\n [GCP_FUNCTION_CONTEXT_ID]: context.id,\n [GCP_FUNCTION_CONTEXT_SOURCE]: context.source,\n [GCP_FUNCTION_CONTEXT_SPECVERSION]: context.specversion,\n [GCP_FUNCTION_CONTEXT_TIME]: context.time,\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","getClient","getFunctionName","hasSpanStreamingEnabled","SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK","startSpanManual","SENTRY_OP","FUNCTION_GCP","FAAS_NAME","FAAS_TRIGGER","SENTRY_SEGMENT_NAME_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","GCP_FUNCTION_CONTEXT_TYPE","GCP_FUNCTION_CONTEXT_ID","GCP_FUNCTION_CONTEXT_SOURCE","GCP_FUNCTION_CONTEXT_SPECVERSION","GCP_FUNCTION_CONTEXT_TIME","getCurrentScope","captureException","scope","markEventUnhandled","flush","DEBUG_BUILD","debug","handleCallbackErrors"],"mappings":";;;;;;;;;AAkCO,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,MAAM,SAASC,cAAA,EAAU;AAEzB,IAAA,MAAM,eAAeC,qBAAA,EAAgB;AACr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AA,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,CAAsC,OAAA,EAAS,WAAW,CAAA;AAAA,YACjE,CAAA,GAAA,KAAO;AACL,cAAAN,qBAAA,CAAiB,KAAK,CAAAC,MAAAA,KAASC,wBAAA,CAAmBD,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 {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n SENTRY_OP,\n GCP_FUNCTION_CONTEXT_TYPE,\n GCP_FUNCTION_CONTEXT_ID,\n GCP_FUNCTION_CONTEXT_SOURCE,\n GCP_FUNCTION_CONTEXT_SPECVERSION,\n GCP_FUNCTION_CONTEXT_TIME,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, getFunctionName, 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 const client = getClient();\n\n const functionName = getFunctionName();\n const name =\n client && hasSpanStreamingEnabled(client)\n ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK\n : context.type || '<unknown>';\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'cloud_event',\n [SENTRY_SEGMENT_NAME_SOURCE]: 'component',\n [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event',\n [GCP_FUNCTION_CONTEXT_TYPE]: context.type,\n [GCP_FUNCTION_CONTEXT_ID]: context.id,\n [GCP_FUNCTION_CONTEXT_SOURCE]: context.source,\n [GCP_FUNCTION_CONTEXT_SPECVERSION]: context.specversion,\n [GCP_FUNCTION_CONTEXT_TIME]: context.time,\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","getClient","getFunctionName","hasSpanStreamingEnabled","SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK","startSpanManual","SENTRY_OP","FUNCTION_GCP","FAAS_NAME","FAAS_TRIGGER","SENTRY_SEGMENT_NAME_SOURCE","SENTRY_ORIGIN","GCP_FUNCTION_CONTEXT_TYPE","GCP_FUNCTION_CONTEXT_ID","GCP_FUNCTION_CONTEXT_SOURCE","GCP_FUNCTION_CONTEXT_SPECVERSION","GCP_FUNCTION_CONTEXT_TIME","getCurrentScope","captureException","scope","markEventUnhandled","flush","DEBUG_BUILD","debug","handleCallbackErrors"],"mappings":";;;;;;;;;AAkCO,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,O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,MAAAA,EAAO,0CAA0C,CAAC,CAAA;AAAA,UAC1G;AACA,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,CAAsC,OAAA,EAAS,WAAW,CAAA;AAAA,YACjE,CAAA,GAAA,KAAO;AACL,cAAAN,qBAAA,CAAiB,KAAK,CAAAC,MAAAA,KAASC,wBAAA,CAAmBD,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;;;;"}
@@ -38,7 +38,7 @@ function _wrapHttpFunction(fn, options) {
38
38
  [attributes.FAAS_NAME]: functionName,
39
39
  [attributes.FAAS_TRIGGER]: "http",
40
40
  [attributes.SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? "component" : "route",
41
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_http",
41
+ [attributes.SENTRY_ORIGIN]: "auto.function.serverless.gcp_http",
42
42
  // The method and path used to be the span name; they stay on the span so that
43
43
  // information survives the low-cardinality rename.
44
44
  [attributes.HTTP_REQUEST_METHOD]: reqMethod || void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n HTTP_REQUEST_METHOD,\n SENTRY_OP,\n URL_PATH,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\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, getFunctionName, 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 const functionName = getFunctionName();\n\n const client = getClient();\n const hasSpanStreaming = client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK : `${reqMethod} ${reqUrl}`;\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'http',\n [SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? 'component' : 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n // The method and path used to be the span name; they stay on the span so that\n // information survives the low-cardinality rename.\n [HTTP_REQUEST_METHOD]: reqMethod || undefined,\n [URL_PATH]: reqUrl || undefined,\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","getFunctionName","getClient","hasSpanStreamingEnabled","SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK","startSpanManual","SENTRY_OP","FUNCTION_GCP","FAAS_NAME","FAAS_TRIGGER","SENTRY_SEGMENT_NAME_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","HTTP_REQUEST_METHOD","URL_PATH","setHttpStatus","flush","DEBUG_BUILD","debug","handleCallbackErrors","captureException","markEventUnhandled"],"mappings":";;;;;;;;;AAiCO,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,GA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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;;;;"}
1
+ {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n HTTP_REQUEST_METHOD,\n SENTRY_OP,\n URL_PATH,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n httpRequestToRequestData,\n isString,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\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, getFunctionName, 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 const functionName = getFunctionName();\n\n const client = getClient();\n const hasSpanStreaming = client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK : `${reqMethod} ${reqUrl}`;\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'http',\n [SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? 'component' : 'route',\n [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n // The method and path used to be the span name; they stay on the span so that\n // information survives the low-cardinality rename.\n [HTTP_REQUEST_METHOD]: reqMethod || undefined,\n [URL_PATH]: reqUrl || undefined,\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","getFunctionName","getClient","hasSpanStreamingEnabled","SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK","startSpanManual","SENTRY_OP","FUNCTION_GCP","FAAS_NAME","FAAS_TRIGGER","SENTRY_SEGMENT_NAME_SOURCE","SENTRY_ORIGIN","HTTP_REQUEST_METHOD","URL_PATH","setHttpStatus","flush","DEBUG_BUILD","debug","handleCallbackErrors","captureException","markEventUnhandled"],"mappings":";;;;;;;;;AAiCO,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,EA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B,GAAG,gBAAA,GAAmB,WAAA,GAAc,OAAA;AAAA,YAC/D,CAACC,wBAAa,GAAG,mCAAA;AAAA;AAAA;AAAA,YAGjB,CAACC,8BAAmB,GAAG,SAAA,IAAa,MAAA;AAAA,YACpC,CAACC,mBAAQ,GAAG,MAAA,IAAU;AAAA;AACxB,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;;;;"}
@@ -66,7 +66,7 @@ function fillGrpcFunction(stub, serviceIdentifier, methodName) {
66
66
  onlyIfParent: true,
67
67
  attributes: {
68
68
  [attributes.SENTRY_OP]: op.GRPC,
69
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.grpc.serverless",
69
+ [attributes.SENTRY_ORIGIN]: "auto.grpc.serverless",
70
70
  [attributes.RPC_SYSTEM_NAME]: "grpc",
71
71
  [attributes.RPC_SERVICE]: serviceIdentifier,
72
72
  [attributes.RPC_METHOD]: methodName
@@ -1 +1 @@
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 { GRPC } 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(stub, methodName, (orig: GrpcFunction): GrpcFunction => (...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]: GRPC,\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/** Identifies service by its address */\nfunction identifyService(servicePath: string): string {\n const match = servicePath.match(SERVICE_PATH_REGEX);\n return match?.[1] ||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d,UAAA,EAAY;AAAA,QACV,CAACC,oBAAS,GAAGC,OAAA;AAAA,QACb,CAACC,qCAAgC,GAAG,sBAAA;AAAA,QACpC,CAACC,0BAAe,GAAG,MAAA;AAAA,QACnB,CAACC,sBAAW,GAAG,iBAAA;AAAA,QACf,CAACC,qBAAU,GAAG;AAAA;AAChB,KACD,CAAA;AACD,IAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,IAAA,CAAK,GAAA,EAAI;AAAA,MACX;AAAA,IACF,CAAC,CAAA;AACD,IAAA,OAAO,GAAA;AAAA,EACT,CAAC,CAAA;AACH;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, SENTRY_ORIGIN } from '@sentry/conventions/attributes';\nimport { GRPC } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient } 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(stub, methodName, (orig: GrpcFunction): GrpcFunction => (...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]: GRPC,\n [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/** 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","SENTRY_OP","GRPC","SENTRY_ORIGIN","RPC_SYSTEM_NAME","RPC_SERVICE","RPC_METHOD"],"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,QAAAA,SAAA;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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CAAM,IAAA,EAAM,IAAI,CAAA;AACjC,IAAA,IAAI,OAAO,KAAK,EAAA,KAAO,UAAA,IAAc,CAAC,aAAA,CAAc,GAAA,CAAIE,cAAA,EAAqB,CAAA,EAAG;AAC9E,MAAA,OAAO,GAAA;AAAA,IACT;AACA,IAAA,MAAM,OAAOC,sBAAA,CAAkB;AAAA,MAC7B,IAAA,EAAM,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA;AAAA,MAC/B,YAAA,EAAc,IAAA;AAAA,MACd,UAAA,EAAY;AAAA,QACV,CAACC,oBAAS,GAAGC,OAAA;AAAA,QACb,CAACC,wBAAa,GAAG,sBAAA;AAAA,QACjB,CAACC,0BAAe,GAAG,MAAA;AAAA,QACnB,CAACC,sBAAW,GAAG,iBAAA;AAAA,QACf,CAACC,qBAAU,GAAG;AAAA;AAChB,KACD,CAAA;AACD,IAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,IAAA,CAAK,GAAA,EAAI;AAAA,MACX;AAAA,IACF,CAAC,CAAA;AACD,IAAA,OAAO,GAAA;AAAA,EACT,CAAC,CAAA;AACH;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;;;;;"}
@@ -38,7 +38,7 @@ function wrapRequestFunction(orig) {
38
38
  onlyIfParent: true,
39
39
  attributes: {
40
40
  [attributes.SENTRY_OP]: op.HTTP_CLIENT,
41
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.serverless",
41
+ [attributes.SENTRY_ORIGIN]: "auto.http.serverless",
42
42
  [attributes.HTTP_REQUEST_METHOD]: httpMethod,
43
43
  [attributes.SERVER_ADDRESS]: serverAddress,
44
44
  [attributes.URL_DOMAIN]: serverAddress,
@@ -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 { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_DOMAIN, URL_FULL } from '@sentry/conventions/attributes';\nimport { HTTP_CLIENT } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n hasSpanStreamingEnabled,\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 client = getClient();\n const serverAddress = getServerAddress(this.apiEndpoint);\n // Span names must not contain a query string, and callers can pass any URI they want. With span\n // streaming they have to be low cardinality on top of that, so the URI is dropped entirely and only\n // the API endpoint is kept — `reqOpts.uri` is a path with no route to parameterize.\n const streamedName = serverAddress ? `${httpMethod} ${serverAddress}` : httpMethod;\n const span = SETUP_CLIENTS.has(client as Client)\n ? startInactiveSpan({\n name:\n !!client && hasSpanStreamingEnabled(client)\n ? streamedName\n : `${httpMethod} ${stripUrlQueryAndFragment(reqOpts.uri)}`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: HTTP_CLIENT,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n [HTTP_REQUEST_METHOD]: httpMethod,\n [SERVER_ADDRESS]: serverAddress,\n [URL_DOMAIN]: serverAddress,\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","hasSpanStreamingEnabled","stripUrlQueryAndFragment","SENTRY_OP","HTTP_CLIENT","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","HTTP_REQUEST_METHOD","SERVER_ADDRESS","URL_DOMAIN","URL_FULL","filterCollectedUrl","SentryNonRecordingSpan","parseStringToURLObject","isURLObjectRelative"],"mappings":";;;;;;;AAyBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,Q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AACC,oBAAS,GAAGC,cAAA;AAAA,QACb,CAACC,qCAAgC,GAAG,sBAAA;AAAA,QACpC,CAACC,8BAAmB,GAAG,UAAA;AAAA,QACvB,CAACC,yBAAc,GAAG,aAAA;AAAA,QAClB,CAACC,qBAAU,GAAG,aAAA;AAAA,QACd,CAACC,mBAAQ,GAAGC,uBAAA,CAAmB,QAAQ,GAAG;AAAA;AAC5C,KACD,CAAA,GACD,IAAIC,2BAAA,EAAuB;AAC/B,IAAA,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,OAAA,EAAS,CAAA,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
+ {"version":3,"file":"google-cloud-http.js","sources":["../../../src/integrations/google-cloud-http.ts"],"sourcesContent":["import type * as common from '@google-cloud/common';\nimport {\n HTTP_REQUEST_METHOD,\n SENTRY_OP,\n SERVER_ADDRESS,\n URL_DOMAIN,\n URL_FULL,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { HTTP_CLIENT } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n hasSpanStreamingEnabled,\n isURLObjectRelative,\n parseStringToURLObject,\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 client = getClient();\n const serverAddress = getServerAddress(this.apiEndpoint);\n // Span names must not contain a query string, and callers can pass any URI they want. With span\n // streaming they have to be low cardinality on top of that, so the URI is dropped entirely and only\n // the API endpoint is kept — `reqOpts.uri` is a path with no route to parameterize.\n const streamedName = serverAddress ? `${httpMethod} ${serverAddress}` : httpMethod;\n const span = SETUP_CLIENTS.has(client as Client)\n ? startInactiveSpan({\n name:\n !!client && hasSpanStreamingEnabled(client)\n ? streamedName\n : `${httpMethod} ${stripUrlQueryAndFragment(reqOpts.uri)}`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: HTTP_CLIENT,\n [SENTRY_ORIGIN]: 'auto.http.serverless',\n [HTTP_REQUEST_METHOD]: httpMethod,\n [SERVER_ADDRESS]: serverAddress,\n [URL_DOMAIN]: serverAddress,\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","hasSpanStreamingEnabled","stripUrlQueryAndFragment","SENTRY_OP","HTTP_CLIENT","SENTRY_ORIGIN","HTTP_REQUEST_METHOD","SERVER_ADDRESS","URL_DOMAIN","URL_FULL","filterCollectedUrl","SentryNonRecordingSpan","parseStringToURLObject","isURLObjectRelative"],"mappings":";;;;;;;AA+BA,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,QAAAA,SAAA,CAAK,YAAA,CAAa,OAAA,CAAQ,SAAA,EAAW,SAAA,EAAW,mBAAmB,CAAA;AAAA,MACrE,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,GAA6BC,uBAAkB,2BAA2B;AAGvF,SAAS,oBAAoB,IAAA,EAAwC;AACnE,EAAA,OAAO,SAAgC,SAA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B,GAAG,CAAA,GAAI,IAAI,IAAA,GAAO,WAAA;AACvD;;;;"}
@@ -1,6 +1,6 @@
1
- import { GCP_FUNCTION_CONTEXT_TIME, GCP_FUNCTION_CONTEXT_SPECVERSION, GCP_FUNCTION_CONTEXT_SOURCE, GCP_FUNCTION_CONTEXT_ID, GCP_FUNCTION_CONTEXT_TYPE, SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, FAAS_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
1
+ import { GCP_FUNCTION_CONTEXT_TIME, GCP_FUNCTION_CONTEXT_SPECVERSION, GCP_FUNCTION_CONTEXT_SOURCE, GCP_FUNCTION_CONTEXT_ID, GCP_FUNCTION_CONTEXT_TYPE, SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, FAAS_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
2
2
  import { FUNCTION_GCP } from '@sentry/conventions/op';
3
- import { getClient, hasSpanStreamingEnabled, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, handleCallbackErrors, debug } from '@sentry/core';
3
+ import { getClient, hasSpanStreamingEnabled, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, handleCallbackErrors, debug } from '@sentry/core';
4
4
  import { startSpanManual, getCurrentScope, captureException, flush } from '@sentry/node';
5
5
  import { DEBUG_BUILD } from '../debug-build.js';
6
6
  import { proxyFunction, domainify, getFunctionName, markEventUnhandled } from '../utils.js';
@@ -25,7 +25,7 @@ function _wrapCloudEventFunction(fn, wrapOptions = {}) {
25
25
  [FAAS_NAME]: functionName,
26
26
  [FAAS_TRIGGER]: "cloud_event",
27
27
  [SENTRY_SEGMENT_NAME_SOURCE]: "component",
28
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_cloud_event",
28
+ [SENTRY_ORIGIN]: "auto.function.serverless.gcp_cloud_event",
29
29
  [GCP_FUNCTION_CONTEXT_TYPE]: context.type,
30
30
  [GCP_FUNCTION_CONTEXT_ID]: context.id,
31
31
  [GCP_FUNCTION_CONTEXT_SOURCE]: context.source,
@@ -1 +1 @@
1
- {"version":3,"file":"cloud_events.js","sources":["../../../src/gcpfunction/cloud_events.ts"],"sourcesContent":["import {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n SENTRY_OP,\n GCP_FUNCTION_CONTEXT_TYPE,\n GCP_FUNCTION_CONTEXT_ID,\n GCP_FUNCTION_CONTEXT_SOURCE,\n GCP_FUNCTION_CONTEXT_SPECVERSION,\n GCP_FUNCTION_CONTEXT_TIME,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, getFunctionName, 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 const client = getClient();\n\n const functionName = getFunctionName();\n const name =\n client && hasSpanStreamingEnabled(client)\n ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK\n : context.type || '<unknown>';\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'cloud_event',\n [SENTRY_SEGMENT_NAME_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event',\n [GCP_FUNCTION_CONTEXT_TYPE]: context.type,\n [GCP_FUNCTION_CONTEXT_ID]: context.id,\n [GCP_FUNCTION_CONTEXT_SOURCE]: context.source,\n [GCP_FUNCTION_CONTEXT_SPECVERSION]: context.specversion,\n [GCP_FUNCTION_CONTEXT_TIME]: context.time,\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":";;;;;;;AAkCO,SAAS,sBAAA,CACd,EAAA,EACA,WAAA,GAAyD,EAAC,EAC1B;AACh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.ts"],"sourcesContent":["import {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n SENTRY_OP,\n GCP_FUNCTION_CONTEXT_TYPE,\n GCP_FUNCTION_CONTEXT_ID,\n GCP_FUNCTION_CONTEXT_SOURCE,\n GCP_FUNCTION_CONTEXT_SPECVERSION,\n GCP_FUNCTION_CONTEXT_TIME,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\n} from '@sentry/core';\nimport { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, getFunctionName, 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 const client = getClient();\n\n const functionName = getFunctionName();\n const name =\n client && hasSpanStreamingEnabled(client)\n ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK\n : context.type || '<unknown>';\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'cloud_event',\n [SENTRY_SEGMENT_NAME_SOURCE]: 'component',\n [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_cloud_event',\n [GCP_FUNCTION_CONTEXT_TYPE]: context.type,\n [GCP_FUNCTION_CONTEXT_ID]: context.id,\n [GCP_FUNCTION_CONTEXT_SOURCE]: context.source,\n [GCP_FUNCTION_CONTEXT_SPECVERSION]: context.specversion,\n [GCP_FUNCTION_CONTEXT_TIME]: context.time,\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":";;;;;;;AAkCO,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,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C1G;AACA,UAAA,IAAA,CAAK,GAAA,EAAI;AAGT,UAAA,KAAA,CAAM,OAAA,CAAQ,YAAY,CAAA,CACvB,IAAA,CAAK,MAAM,CAAA,CAAA,KAAK;AACf,YAAA,WAAA,IAAe,KAAA,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,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,6 +1,6 @@
1
- import { URL_PATH, HTTP_REQUEST_METHOD, SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, FAAS_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
1
+ import { URL_PATH, HTTP_REQUEST_METHOD, SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, FAAS_TRIGGER, FAAS_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
2
2
  import { FUNCTION_GCP } from '@sentry/conventions/op';
3
- import { stripUrlQueryAndFragment, isString, httpRequestToRequestData, getClient, hasSpanStreamingEnabled, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, debug, handleCallbackErrors } from '@sentry/core';
3
+ import { stripUrlQueryAndFragment, isString, httpRequestToRequestData, getClient, hasSpanStreamingEnabled, SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK, setHttpStatus, debug, handleCallbackErrors } from '@sentry/core';
4
4
  import { continueTrace, getCurrentScope, startSpanManual, flush, captureException } from '@sentry/node';
5
5
  import { DEBUG_BUILD } from '../debug-build.js';
6
6
  import { proxyFunction, domainify, getFunctionName, markEventUnhandled } from '../utils.js';
@@ -36,7 +36,7 @@ function _wrapHttpFunction(fn, options) {
36
36
  [FAAS_NAME]: functionName,
37
37
  [FAAS_TRIGGER]: "http",
38
38
  [SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? "component" : "route",
39
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_http",
39
+ [SENTRY_ORIGIN]: "auto.function.serverless.gcp_http",
40
40
  // The method and path used to be the span name; they stay on the span so that
41
41
  // information survives the low-cardinality rename.
42
42
  [HTTP_REQUEST_METHOD]: reqMethod || void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n HTTP_REQUEST_METHOD,\n SENTRY_OP,\n URL_PATH,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\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, getFunctionName, 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 const functionName = getFunctionName();\n\n const client = getClient();\n const hasSpanStreaming = client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK : `${reqMethod} ${reqUrl}`;\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'http',\n [SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? 'component' : 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n // The method and path used to be the span name; they stay on the span so that\n // information survives the low-cardinality rename.\n [HTTP_REQUEST_METHOD]: reqMethod || undefined,\n [URL_PATH]: reqUrl || undefined,\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":";;;;;;;AAiCO,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,MA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C,CAAC,mBAAmB,GAAG,SAAA,IAAa,MAAA;AAAA,YACpC,CAAC,QAAQ,GAAG,MAAA,IAAU;AAAA;AACxB,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,YAAA,aAAA,CAAc,IAAA,EAAM,IAAI,UAAU,CAAA;AAClC,YAAA,IAAA,CAAK,GAAA,EAAI;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
+ {"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n SENTRY_SEGMENT_NAME_SOURCE,\n FAAS_NAME,\n FAAS_TRIGGER,\n HTTP_REQUEST_METHOD,\n SENTRY_OP,\n URL_PATH,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { FUNCTION_GCP } from '@sentry/conventions/op';\nimport {\n debug,\n getClient,\n handleCallbackErrors,\n hasSpanStreamingEnabled,\n httpRequestToRequestData,\n isString,\n SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK,\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, getFunctionName, 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 const functionName = getFunctionName();\n\n const client = getClient();\n const hasSpanStreaming = client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming ? functionName || SERVERLESS_FUNCTION_SPAN_NAME_FALLBACK : `${reqMethod} ${reqUrl}`;\n\n return startSpanManual(\n {\n name,\n attributes: {\n [SENTRY_OP]: FUNCTION_GCP,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: 'http',\n [SENTRY_SEGMENT_NAME_SOURCE]: hasSpanStreaming ? 'component' : 'route',\n [SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n // The method and path used to be the span name; they stay on the span so that\n // information survives the low-cardinality rename.\n [HTTP_REQUEST_METHOD]: reqMethod || undefined,\n [URL_PATH]: reqUrl || undefined,\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":";;;;;;;AAiCO,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;A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AA,YAC/D,CAAC,aAAa,GAAG,mCAAA;AAAA;AAAA;AAAA,YAGjB,CAAC,mBAAmB,GAAG,SAAA,IAAa,MAAA;AAAA,YACpC,CAAC,QAAQ,GAAG,MAAA,IAAU;AAAA;AACxB,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,YAAA,aAAA,CAAc,IAAA,EAAM,IAAI,UAAU,CAAA;AAClC,YAAA,IAAA,CAAK,GAAA,EAAI;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,6 +1,6 @@
1
- import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes';
1
+ import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_ORIGIN, SENTRY_OP } from '@sentry/conventions/attributes';
2
2
  import { GRPC } from '@sentry/conventions/op';
3
- import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
3
+ import { defineIntegration, fill, getClient } from '@sentry/core';
4
4
  import { startInactiveSpan } from '@sentry/node';
5
5
 
6
6
  const SERVICE_PATH_REGEX = /^(\w+)\.googleapis.com$/;
@@ -64,7 +64,7 @@ function fillGrpcFunction(stub, serviceIdentifier, methodName) {
64
64
  onlyIfParent: true,
65
65
  attributes: {
66
66
  [SENTRY_OP]: GRPC,
67
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.grpc.serverless",
67
+ [SENTRY_ORIGIN]: "auto.grpc.serverless",
68
68
  [RPC_SYSTEM_NAME]: "grpc",
69
69
  [RPC_SERVICE]: serviceIdentifier,
70
70
  [RPC_METHOD]: methodName
@@ -1 +1 @@
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 { GRPC } 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(stub, methodName, (orig: GrpcFunction): GrpcFunction => (...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]: GRPC,\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/** 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,CAA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,EAAG;AAC9E,MAAA,OAAO,GAAA;AAAA,IACT;AACA,IAAA,MAAM,OAAO,iBAAA,CAAkB;AAAA,MAC7B,IAAA,EAAM,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA;AAAA,MAC/B,YAAA,EAAc,IAAA;AAAA,MACd,UAAA,EAAY;AAAA,QACV,CAAC,SAAS,GAAG,IAAA;AAAA,QACb,CAAC,gCAAgC,GAAG,sBAAA;AAAA,QACpC,CAAC,eAAe,GAAG,MAAA;AAAA,QACnB,CAAC,WAAW,GAAG,iBAAA;AAAA,QACf,CAAC,UAAU,GAAG;AAAA;AAChB,KACD,CAAA;AACD,IAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,IAAA,CAAK,GAAA,EAAI;AAAA,MACX;AAAA,IACF,CAAC,CAAA;AACD,IAAA,OAAO,GAAA;AAAA,EACT,CAAC,CAAA;AACH;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, SENTRY_ORIGIN } from '@sentry/conventions/attributes';\nimport { GRPC } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient } 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(stub, methodName, (orig: GrpcFunction): GrpcFunction => (...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]: GRPC,\n [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/** 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,C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,CAAC,IAAA,KAAqC,IAAI,IAAA,KAAS;AACxE,IAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,IAAA,EAAM,IAAI,CAAA;AACjC,IAAA,IAAI,OAAO,KAAK,EAAA,KAAO,UAAA,IAAc,CAAC,aAAA,CAAc,GAAA,CAAI,SAAA,EAAqB,CAAA,EAAG;AAC9E,MAAA,OAAO,GAAA;AAAA,IACT;AACA,IAAA,MAAM,OAAO,iBAAA,CAAkB;AAAA,MAC7B,IAAA,EAAM,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA;AAAA,MAC/B,YAAA,EAAc,IAAA;AAAA,MACd,UAAA,EAAY;AAAA,QACV,CAAC,SAAS,GAAG,IAAA;AAAA,QACb,CAAC,aAAa,GAAG,sBAAA;AAAA,QACjB,CAAC,eAAe,GAAG,MAAA;AAAA,QACnB,CAAC,WAAW,GAAG,iBAAA;AAAA,QACf,CAAC,UAAU,GAAG;AAAA;AAChB,KACD,CAAA;AACD,IAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,IAAA,CAAK,GAAA,EAAI;AAAA,MACX;AAAA,IACF,CAAC,CAAA;AACD,IAAA,OAAO,GAAA;AAAA,EACT,CAAC,CAAA;AACH;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,6 +1,6 @@
1
- import { URL_FULL, URL_DOMAIN, SERVER_ADDRESS, HTTP_REQUEST_METHOD, SENTRY_OP } from '@sentry/conventions/attributes';
1
+ import { URL_FULL, URL_DOMAIN, SERVER_ADDRESS, HTTP_REQUEST_METHOD, SENTRY_ORIGIN, SENTRY_OP } from '@sentry/conventions/attributes';
2
2
  import { HTTP_CLIENT } from '@sentry/conventions/op';
3
- import { defineIntegration, fill, getClient, filterCollectedUrl, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, hasSpanStreamingEnabled, stripUrlQueryAndFragment, SentryNonRecordingSpan, parseStringToURLObject, isURLObjectRelative } from '@sentry/core';
3
+ import { defineIntegration, fill, getClient, filterCollectedUrl, hasSpanStreamingEnabled, stripUrlQueryAndFragment, SentryNonRecordingSpan, parseStringToURLObject, isURLObjectRelative } from '@sentry/core';
4
4
  import { startInactiveSpan } from '@sentry/node';
5
5
 
6
6
  const INTEGRATION_NAME = "GoogleCloudHttp";
@@ -36,7 +36,7 @@ function wrapRequestFunction(orig) {
36
36
  onlyIfParent: true,
37
37
  attributes: {
38
38
  [SENTRY_OP]: HTTP_CLIENT,
39
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.serverless",
39
+ [SENTRY_ORIGIN]: "auto.http.serverless",
40
40
  [HTTP_REQUEST_METHOD]: httpMethod,
41
41
  [SERVER_ADDRESS]: serverAddress,
42
42
  [URL_DOMAIN]: serverAddress,
@@ -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 { HTTP_REQUEST_METHOD, SENTRY_OP, SERVER_ADDRESS, URL_DOMAIN, URL_FULL } from '@sentry/conventions/attributes';\nimport { HTTP_CLIENT } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n hasSpanStreamingEnabled,\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 client = getClient();\n const serverAddress = getServerAddress(this.apiEndpoint);\n // Span names must not contain a query string, and callers can pass any URI they want. With span\n // streaming they have to be low cardinality on top of that, so the URI is dropped entirely and only\n // the API endpoint is kept — `reqOpts.uri` is a path with no route to parameterize.\n const streamedName = serverAddress ? `${httpMethod} ${serverAddress}` : httpMethod;\n const span = SETUP_CLIENTS.has(client as Client)\n ? startInactiveSpan({\n name:\n !!client && hasSpanStreamingEnabled(client)\n ? streamedName\n : `${httpMethod} ${stripUrlQueryAndFragment(reqOpts.uri)}`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: HTTP_CLIENT,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n [HTTP_REQUEST_METHOD]: httpMethod,\n [SERVER_ADDRESS]: serverAddress,\n [URL_DOMAIN]: serverAddress,\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":";;;;;AAyBA,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,CAAa,OAAA,CAAQ,SAAA,EAAW,SAAA,EAAW,mBAAmB,CAAA;AAAA,MACrE,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,oBAAoB,IAAA,EAAwC;AACnE,EAAA,OAAO,SAAgC,SAAyB,QAAA,EAAkC;AAChG,IAAA,MAAM,UAAA,GAAa,QAAQ,MAAA,IAAU,KAAA;AACrC,IAAA,MAAM,SAAS,SAAA,EAAU;AACzB,IAAA,MAAM,aAAA,GAAgB,gBAAA,CAAiB,IAAA,CAAK,WAAW,CAAA;AAIvD,IAAA,MAAM,eAAe,aAAA,GAAgB,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA,GAAK,UAAA;AACxE,IAAA,MAAM,IAAA,GAAO,aAAA,CAAc,GAAA,CAAI,MAAgB,IAC3C,iBAAA,CAAkB;AAAA,MAChB,IAAA,EACE,CAAC,CAAC,MAAA,IAAU,wBAAwB,MAAM,CAAA,GACtC,YAAA,GACA,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,wBAAA,CAAyB,OAAA,CAAQ,GAAG,CAAC,CAAA,CAAA;AAAA,MAC5D,YAAA,EAAc,IAAA;AAAA,MACd,UAAA,EAAY;AAAA,QACV,CAAC,SAAS,GAAG,WAAA;AAAA,QACb,CAAC,gCAAgC,GAAG,sBAAA;AAAA,QACpC,CAAC,mBAAmB,GAAG,UAAA;AAAA,QACvB,CAAC,cAAc,GAAG,aAAA;AAAA,QAClB,CAAC,UAAU,GAAG,aAAA;AAAA,QACd,CAAC,QAAQ,GAAG,kBAAA,CAAmB,QAAQ,GAAG;AAAA;AAC5C,KACD,CAAA,GACD,IAAI,sBAAA,EAAuB;AAC/B,IAAA,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,OAAA,EAAS,CAAA,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,GAAM,uBAAuB,WAAW,CAAA;AAC9C,EAAA,OAAO,OAAO,CAAC,mBAAA,CAAoB,GAAG,CAAA,GAAI,IAAI,IAAA,GAAO,WAAA;AACvD;;;;"}
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 {\n HTTP_REQUEST_METHOD,\n SENTRY_OP,\n SERVER_ADDRESS,\n URL_DOMAIN,\n URL_FULL,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { HTTP_CLIENT } from '@sentry/conventions/op';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n hasSpanStreamingEnabled,\n isURLObjectRelative,\n parseStringToURLObject,\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 client = getClient();\n const serverAddress = getServerAddress(this.apiEndpoint);\n // Span names must not contain a query string, and callers can pass any URI they want. With span\n // streaming they have to be low cardinality on top of that, so the URI is dropped entirely and only\n // the API endpoint is kept — `reqOpts.uri` is a path with no route to parameterize.\n const streamedName = serverAddress ? `${httpMethod} ${serverAddress}` : httpMethod;\n const span = SETUP_CLIENTS.has(client as Client)\n ? startInactiveSpan({\n name:\n !!client && hasSpanStreamingEnabled(client)\n ? streamedName\n : `${httpMethod} ${stripUrlQueryAndFragment(reqOpts.uri)}`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: HTTP_CLIENT,\n [SENTRY_ORIGIN]: 'auto.http.serverless',\n [HTTP_REQUEST_METHOD]: httpMethod,\n [SERVER_ADDRESS]: serverAddress,\n [URL_DOMAIN]: serverAddress,\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":";;;;;AA+BA,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,CAAa,OAAA,CAAQ,SAAA,EAAW,SAAA,EAAW,mBAAmB,CAAA;AAAA,MACrE,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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AAI,CAAA;AAAA,IAClB,CAAC,CAAA;AAAA,EACH,CAAA;AACF;AAGA,SAAS,iBAAiB,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":"11.3.0","sideEffects":false}
1
+ {"type":"module","version":"11.5.0","sideEffects":false}
@@ -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,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,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,8BAA8B,EAC9B,+BAA+B,EAC/B,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB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AA4B,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,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,0BAA0B,GAC3B,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,a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@@ -1 +1 @@
1
- {"version":3,"file":"google-cloud-http.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-http.ts"],"names":[],"mappings":"AAkDA;;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":"AAwDA;;GAEG;AACH,eAAO,MAAM,0BAA0B;eAxBqB,OAAO;;;CAwBqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/google-cloud-serverless",
3
- "version": "11.3.0",
3
+ "version": "11.5.0",
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",
@@ -36,11 +36,11 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
- "@sentry/conventions": "^0.25.0",
40
- "@sentry/core": "11.3.0",
41
- "@sentry/node": "11.3.0",
42
- "@sentry/server-runtime-injection": "11.3.0",
43
- "@sentry/server-utils": "11.3.0"
39
+ "@sentry/conventions": "^0.26.0",
40
+ "@sentry/core": "11.5.0",
41
+ "@sentry/node": "11.5.0",
42
+ "@sentry/server-runtime-injection": "11.5.0",
43
+ "@sentry/server-utils": "11.5.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@google-cloud/bigquery": "^5.3.0",