@sentry/google-cloud-serverless 10.53.0 → 10.54.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.
- package/build/cjs/debug-build.js +0 -5
- package/build/cjs/debug-build.js.map +1 -1
- package/build/cjs/gcpfunction/cloud_events.js +30 -53
- package/build/cjs/gcpfunction/cloud_events.js.map +1 -1
- package/build/cjs/gcpfunction/events.js +29 -54
- package/build/cjs/gcpfunction/events.js.map +1 -1
- package/build/cjs/gcpfunction/http.js +20 -43
- package/build/cjs/gcpfunction/http.js.map +1 -1
- package/build/cjs/integrations/gcp-context.js +38 -0
- package/build/cjs/integrations/gcp-context.js.map +1 -0
- package/build/cjs/integrations/google-cloud-grpc.js +33 -54
- package/build/cjs/integrations/google-cloud-grpc.js.map +1 -1
- package/build/cjs/integrations/google-cloud-http.js +17 -30
- package/build/cjs/integrations/google-cloud-http.js.map +1 -1
- package/build/cjs/sdk.js +10 -17
- package/build/cjs/sdk.js.map +1 -1
- package/build/cjs/utils.js +5 -28
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/debug-build.js +0 -5
- package/build/esm/debug-build.js.map +1 -1
- package/build/esm/gcpfunction/cloud_events.js +30 -53
- package/build/esm/gcpfunction/cloud_events.js.map +1 -1
- package/build/esm/gcpfunction/events.js +29 -54
- package/build/esm/gcpfunction/events.js.map +1 -1
- package/build/esm/gcpfunction/http.js +20 -43
- package/build/esm/gcpfunction/http.js.map +1 -1
- package/build/esm/integrations/gcp-context.js +36 -0
- package/build/esm/integrations/gcp-context.js.map +1 -0
- package/build/esm/integrations/google-cloud-grpc.js +33 -54
- package/build/esm/integrations/google-cloud-grpc.js.map +1 -1
- package/build/esm/integrations/google-cloud-http.js +17 -30
- package/build/esm/integrations/google-cloud-http.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk.js +10 -17
- package/build/esm/sdk.js.map +1 -1
- package/build/esm/utils.js +5 -28
- package/build/esm/utils.js.map +1 -1
- package/build/types/integrations/gcp-context.d.ts +2 -0
- package/build/types/integrations/gcp-context.d.ts.map +1 -0
- package/build/types/sdk.d.ts.map +1 -1
- package/build/types-ts3.8/integrations/gcp-context.d.ts +2 -0
- package/package.json +4 -4
|
@@ -3,75 +3,52 @@ import { continueTrace, getCurrentScope, startSpanManual, flush, captureExceptio
|
|
|
3
3
|
import { DEBUG_BUILD } from '../debug-build.js';
|
|
4
4
|
import { proxyFunction, domainify, markEventUnhandled } from '../utils.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Wraps an HTTP function handler adding it error capture and tracing capabilities.
|
|
8
|
-
*
|
|
9
|
-
* @param fn HTTP Handler
|
|
10
|
-
* @param options Options
|
|
11
|
-
* @returns HTTP handler
|
|
12
|
-
*/
|
|
13
6
|
function wrapHttpFunction(fn, wrapOptions = {}) {
|
|
14
7
|
const wrap = (f) => domainify(_wrapHttpFunction(f, wrapOptions));
|
|
15
|
-
|
|
16
8
|
let overrides;
|
|
17
|
-
|
|
18
|
-
// Functions emulator from firebase-tools has a hack-ish workaround that saves the actual function
|
|
19
|
-
// passed to `onRequest(...)` and in fact runs it so we need to wrap it too.
|
|
20
|
-
const emulatorFunc = (fn ).__emulator_func;
|
|
9
|
+
const emulatorFunc = fn.__emulator_func;
|
|
21
10
|
if (emulatorFunc) {
|
|
22
11
|
overrides = { __emulator_func: proxyFunction(emulatorFunc, wrap) };
|
|
23
12
|
}
|
|
24
13
|
return proxyFunction(fn, wrap, overrides);
|
|
25
14
|
}
|
|
26
|
-
|
|
27
|
-
/** */
|
|
28
15
|
function _wrapHttpFunction(fn, options) {
|
|
29
|
-
const flushTimeout = options.flushTimeout ||
|
|
16
|
+
const flushTimeout = options.flushTimeout || 2e3;
|
|
30
17
|
return (req, res) => {
|
|
31
|
-
const reqMethod = (req.method ||
|
|
32
|
-
const reqUrl = stripUrlQueryAndFragment(req.originalUrl || req.url ||
|
|
33
|
-
|
|
34
|
-
const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;
|
|
18
|
+
const reqMethod = (req.method || "").toUpperCase();
|
|
19
|
+
const reqUrl = stripUrlQueryAndFragment(req.originalUrl || req.url || "");
|
|
20
|
+
const sentryTrace = req.headers && isString(req.headers["sentry-trace"]) ? req.headers["sentry-trace"] : void 0;
|
|
35
21
|
const baggage = req.headers?.baggage;
|
|
36
|
-
|
|
37
22
|
return continueTrace({ sentryTrace, baggage }, () => {
|
|
38
23
|
const normalizedRequest = httpRequestToRequestData(req);
|
|
39
24
|
getCurrentScope().setSDKProcessingMetadata({ normalizedRequest });
|
|
40
|
-
|
|
41
25
|
return startSpanManual(
|
|
42
26
|
{
|
|
43
27
|
name: `${reqMethod} ${reqUrl}`,
|
|
44
|
-
op:
|
|
28
|
+
op: "function.gcp.http",
|
|
45
29
|
attributes: {
|
|
46
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]:
|
|
47
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]:
|
|
48
|
-
}
|
|
30
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route",
|
|
31
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.function.serverless.gcp_http"
|
|
32
|
+
}
|
|
49
33
|
},
|
|
50
|
-
span => {
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
34
|
+
(span) => {
|
|
52
35
|
const _end = res.end;
|
|
53
|
-
|
|
54
|
-
res.end = function (chunk, encoding, cb) {
|
|
36
|
+
res.end = function(chunk, encoding, cb) {
|
|
55
37
|
setHttpStatus(span, res.statusCode);
|
|
56
38
|
span.end();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
.then(() => {
|
|
64
|
-
_end.call(this, chunk, encoding, cb);
|
|
65
|
-
});
|
|
39
|
+
flush(flushTimeout).then(null, (e) => {
|
|
40
|
+
DEBUG_BUILD && debug.error(e);
|
|
41
|
+
}).then(() => {
|
|
42
|
+
_end.call(this, chunk, encoding, cb);
|
|
43
|
+
});
|
|
66
44
|
};
|
|
67
|
-
|
|
68
45
|
return handleCallbackErrors(
|
|
69
46
|
() => fn(req, res),
|
|
70
|
-
err => {
|
|
71
|
-
captureException(err, scope => markEventUnhandled(scope,
|
|
72
|
-
}
|
|
47
|
+
(err) => {
|
|
48
|
+
captureException(err, (scope) => markEventUnhandled(scope, "auto.function.serverless.gcp_http"));
|
|
49
|
+
}
|
|
73
50
|
);
|
|
74
|
-
}
|
|
51
|
+
}
|
|
75
52
|
);
|
|
76
53
|
});
|
|
77
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n setHttpStatus,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, markEventUnhandled, proxyFunction } from '../utils';\nimport type { HttpFunction, WrapperOptions } from './general';\n\n/**\n * Wraps an HTTP function handler adding it error capture and tracing capabilities.\n *\n * @param fn HTTP Handler\n * @param options Options\n * @returns HTTP handler\n */\nexport function wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial<WrapperOptions> = {}): HttpFunction {\n const wrap = (f: HttpFunction): HttpFunction => domainify(_wrapHttpFunction(f, wrapOptions));\n\n let overrides: Record<PropertyKey, unknown> | undefined;\n\n // Functions emulator from firebase-tools has a hack-ish workaround that saves the actual function\n // passed to `onRequest(...)` and in fact runs it so we need to wrap it too.\n const emulatorFunc = (fn as HttpFunction & { __emulator_func?: HttpFunction }).__emulator_func;\n if (emulatorFunc) {\n overrides = { __emulator_func: proxyFunction(emulatorFunc, wrap) };\n }\n return proxyFunction(fn, wrap, overrides);\n}\n\n/** */\nfunction _wrapHttpFunction(fn: HttpFunction, options: Partial<WrapperOptions>): HttpFunction {\n const flushTimeout = options.flushTimeout || 2000;\n return (req, res) => {\n const reqMethod = (req.method || '').toUpperCase();\n const reqUrl = stripUrlQueryAndFragment(req.originalUrl || req.url || '');\n\n const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;\n const baggage = req.headers?.baggage;\n\n return continueTrace({ sentryTrace, baggage }, () => {\n const normalizedRequest = httpRequestToRequestData(req);\n getCurrentScope().setSDKProcessingMetadata({ normalizedRequest });\n\n return startSpanManual(\n {\n name: `${reqMethod} ${reqUrl}`,\n op: 'function.gcp.http',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n },\n },\n span => {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const _end = res.end;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n res.end = function (chunk?: any | (() => void), encoding?: string | (() => void), cb?: () => void): any {\n setHttpStatus(span, res.statusCode);\n span.end();\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n flush(flushTimeout)\n .then(null, e => {\n DEBUG_BUILD && debug.error(e);\n })\n .then(() => {\n _end.call(this, chunk, encoding, cb);\n });\n };\n\n return handleCallbackErrors(\n () => fn(req, res),\n err => {\n captureException(err, scope => markEventUnhandled(scope, 'auto.function.serverless.gcp_http'));\n },\n );\n },\n );\n });\n };\n}\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"http.js","sources":["../../../src/gcpfunction/http.ts"],"sourcesContent":["import {\n debug,\n handleCallbackErrors,\n httpRequestToRequestData,\n isString,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n setHttpStatus,\n stripUrlQueryAndFragment,\n} from '@sentry/core';\nimport { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { domainify, markEventUnhandled, proxyFunction } from '../utils';\nimport type { HttpFunction, WrapperOptions } from './general';\n\n/**\n * Wraps an HTTP function handler adding it error capture and tracing capabilities.\n *\n * @param fn HTTP Handler\n * @param options Options\n * @returns HTTP handler\n */\nexport function wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial<WrapperOptions> = {}): HttpFunction {\n const wrap = (f: HttpFunction): HttpFunction => domainify(_wrapHttpFunction(f, wrapOptions));\n\n let overrides: Record<PropertyKey, unknown> | undefined;\n\n // Functions emulator from firebase-tools has a hack-ish workaround that saves the actual function\n // passed to `onRequest(...)` and in fact runs it so we need to wrap it too.\n const emulatorFunc = (fn as HttpFunction & { __emulator_func?: HttpFunction }).__emulator_func;\n if (emulatorFunc) {\n overrides = { __emulator_func: proxyFunction(emulatorFunc, wrap) };\n }\n return proxyFunction(fn, wrap, overrides);\n}\n\n/** */\nfunction _wrapHttpFunction(fn: HttpFunction, options: Partial<WrapperOptions>): HttpFunction {\n const flushTimeout = options.flushTimeout || 2000;\n return (req, res) => {\n const reqMethod = (req.method || '').toUpperCase();\n const reqUrl = stripUrlQueryAndFragment(req.originalUrl || req.url || '');\n\n const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;\n const baggage = req.headers?.baggage;\n\n return continueTrace({ sentryTrace, baggage }, () => {\n const normalizedRequest = httpRequestToRequestData(req);\n getCurrentScope().setSDKProcessingMetadata({ normalizedRequest });\n\n return startSpanManual(\n {\n name: `${reqMethod} ${reqUrl}`,\n op: 'function.gcp.http',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.serverless.gcp_http',\n },\n },\n span => {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const _end = res.end;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n res.end = function (chunk?: any | (() => void), encoding?: string | (() => void), cb?: () => void): any {\n setHttpStatus(span, res.statusCode);\n span.end();\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n flush(flushTimeout)\n .then(null, e => {\n DEBUG_BUILD && debug.error(e);\n })\n .then(() => {\n _end.call(this, chunk, encoding, cb);\n });\n };\n\n return handleCallbackErrors(\n () => fn(req, res),\n err => {\n captureException(err, scope => markEventUnhandled(scope, 'auto.function.serverless.gcp_http'));\n },\n );\n },\n );\n });\n };\n}\n"],"names":[],"mappings":";;;;;AAsBO,SAAS,gBAAA,CAAiB,EAAA,EAAkB,WAAA,GAAuC,EAAC,EAAiB;AAC1G,EAAA,MAAM,OAAO,CAAC,CAAA,KAAkC,UAAU,iBAAA,CAAkB,CAAA,EAAG,WAAW,CAAC,CAAA;AAE3F,EAAA,IAAI,SAAA;AAIJ,EAAA,MAAM,eAAgB,EAAA,CAAyD,eAAA;AAC/E,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,SAAA,GAAY,EAAE,eAAA,EAAiB,aAAA,CAAc,YAAA,EAAc,IAAI,CAAA,EAAE;AAAA,EACnE;AACA,EAAA,OAAO,aAAA,CAAc,EAAA,EAAI,IAAA,EAAM,SAAS,CAAA;AAC1C;AAGA,SAAS,iBAAA,CAAkB,IAAkB,OAAA,EAAgD;AAC3F,EAAA,MAAM,YAAA,GAAe,QAAQ,YAAA,IAAgB,GAAA;AAC7C,EAAA,OAAO,CAAC,KAAK,GAAA,KAAQ;AACnB,IAAA,MAAM,SAAA,GAAA,CAAa,GAAA,CAAI,MAAA,IAAU,EAAA,EAAI,WAAA,EAAY;AACjD,IAAA,MAAM,SAAS,wBAAA,CAAyB,GAAA,CAAI,WAAA,IAAe,GAAA,CAAI,OAAO,EAAE,CAAA;AAExE,IAAA,MAAM,WAAA,GAAc,GAAA,CAAI,OAAA,IAA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AK,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;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineIntegration, getCurrentScope, safeSetSpanJSONAttributes } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
const GCP_CONTEXT_ATTRIBUTE_MAP = {
|
|
4
|
+
type: "gcp.function.context.type",
|
|
5
|
+
source: "gcp.function.context.source",
|
|
6
|
+
id: "gcp.function.context.id",
|
|
7
|
+
specversion: "gcp.function.context.specversion",
|
|
8
|
+
time: "gcp.function.context.time",
|
|
9
|
+
eventId: "gcp.function.context.event_id",
|
|
10
|
+
timestamp: "gcp.function.context.timestamp",
|
|
11
|
+
eventType: "gcp.function.context.event_type",
|
|
12
|
+
resource: "gcp.function.context.resource"
|
|
13
|
+
};
|
|
14
|
+
const _gcpContextIntegration = (() => {
|
|
15
|
+
return {
|
|
16
|
+
name: "GcpContext",
|
|
17
|
+
processSegmentSpan(span) {
|
|
18
|
+
const gcpContext = getCurrentScope().getScopeData().contexts["gcp.function.context"];
|
|
19
|
+
if (!gcpContext) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const attrs = {};
|
|
23
|
+
for (const [field, attrName] of Object.entries(GCP_CONTEXT_ATTRIBUTE_MAP)) {
|
|
24
|
+
const value = gcpContext[field];
|
|
25
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
26
|
+
attrs[attrName] = value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
safeSetSpanJSONAttributes(span, attrs);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const gcpContextIntegration = defineIntegration(_gcpContextIntegration);
|
|
34
|
+
|
|
35
|
+
export { gcpContextIntegration };
|
|
36
|
+
//# sourceMappingURL=gcp-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcp-context.js","sources":["../../../src/integrations/gcp-context.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, getCurrentScope, safeSetSpanJSONAttributes } from '@sentry/core';\n\nconst GCP_CONTEXT_ATTRIBUTE_MAP: Record<string, string> = {\n type: 'gcp.function.context.type',\n source: 'gcp.function.context.source',\n id: 'gcp.function.context.id',\n specversion: 'gcp.function.context.specversion',\n time: 'gcp.function.context.time',\n eventId: 'gcp.function.context.event_id',\n timestamp: 'gcp.function.context.timestamp',\n eventType: 'gcp.function.context.event_type',\n resource: 'gcp.function.context.resource',\n};\n\nconst _gcpContextIntegration = (() => {\n return {\n name: 'GcpContext',\n processSegmentSpan(span) {\n const gcpContext = getCurrentScope().getScopeData().contexts['gcp.function.context'];\n if (!gcpContext) {\n return;\n }\n\n const attrs: Record<string, unknown> = {};\n for (const [field, attrName] of Object.entries(GCP_CONTEXT_ATTRIBUTE_MAP)) {\n const value = gcpContext[field];\n if (typeof value === 'string' || typeof value === 'number') {\n attrs[attrName] = value;\n }\n }\n safeSetSpanJSONAttributes(span, attrs);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const gcpContextIntegration = defineIntegration(_gcpContextIntegration);\n"],"names":[],"mappings":";;AAGA,MAAM,yBAAA,GAAoD;AAAA,EACxD,IAAA,EAAM,2BAAA;AAAA,EACN,MAAA,EAAQ,6BAAA;AAAA,EACR,EAAA,EAAI,yBAAA;AAAA,EACJ,WAAA,EAAa,kCAAA;AAAA,EACb,IAAA,EAAM,2BAAA;AAAA,EACN,OAAA,EAAS,+BAAA;AAAA,EACT,SAAA,EAAW,gCAAA;AAAA,EACX,SAAA,EAAW,iCAAA;AAAA,EACX,QAAA,EAAU;AACZ,CAAA;AAEA,MAAM,0BAA0B,MAAM;AACpC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,YAAA;AAAA,IACN,mBAAmB,IAAA,EAAM;AACvB,MAAA,MAAM,aAAa,eAAA,EAAgB,CAAE,YAAA,EAAa,CAAE,SAAS,sBAAsB,CAAA;AACnF,MAAA,IAAI,CAAC,UAAA,EAAY;AACf,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,QAAiC,EAAC;AACxC,MAAA,KAAA,MAAW,CAAC,KAAA,EAAO,QAAQ,KAAK,MAAA,CAAO,OAAA,CAAQ,yBAAyB,CAAA,EAAG;AACzE,QAAA,MAAM,KAAA,GAAQ,WAAW,KAAK,CAAA;AAC9B,QAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,OAAO,UAAU,QAAA,EAAU;AAC1D,UAAA,KAAA,CAAM,QAAQ,CAAA,GAAI,KAAA;AAAA,QACpB;AAAA,MACF;AACA,MAAA,yBAAA,CAA0B,MAAM,KAAK,CAAA;AAAA,IACvC;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,qBAAA,GAAwB,kBAAkB,sBAAsB;;;;"}
|
|
@@ -2,23 +2,20 @@ import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN }
|
|
|
2
2
|
import { startInactiveSpan } from '@sentry/node';
|
|
3
3
|
|
|
4
4
|
const SERVICE_PATH_REGEX = /^(\w+)\.googleapis.com$/;
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const SETUP_CLIENTS = new WeakMap();
|
|
9
|
-
|
|
5
|
+
const INTEGRATION_NAME = "GoogleCloudGrpc";
|
|
6
|
+
const SETUP_CLIENTS = /* @__PURE__ */ new WeakMap();
|
|
10
7
|
const _googleCloudGrpcIntegration = ((options = {}) => {
|
|
11
8
|
const optional = options.optional || false;
|
|
12
9
|
return {
|
|
13
10
|
name: INTEGRATION_NAME,
|
|
14
11
|
setupOnce() {
|
|
15
12
|
try {
|
|
16
|
-
|
|
17
|
-
const gaxModule = require('google-gax');
|
|
13
|
+
const gaxModule = require("google-gax");
|
|
18
14
|
fill(
|
|
19
|
-
gaxModule.GrpcClient.prototype,
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
gaxModule.GrpcClient.prototype,
|
|
16
|
+
// eslint-disable-line @typescript-eslint/no-unsafe-member-access
|
|
17
|
+
"createStub",
|
|
18
|
+
wrapCreateStub
|
|
22
19
|
);
|
|
23
20
|
} catch (e) {
|
|
24
21
|
if (!optional) {
|
|
@@ -28,20 +25,14 @@ const _googleCloudGrpcIntegration = ((options = {}) => {
|
|
|
28
25
|
},
|
|
29
26
|
setup(client) {
|
|
30
27
|
SETUP_CLIENTS.set(client, true);
|
|
31
|
-
}
|
|
28
|
+
}
|
|
32
29
|
};
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Google Cloud Platform service requests tracking for GRPC APIs.
|
|
37
|
-
*/
|
|
30
|
+
});
|
|
38
31
|
const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);
|
|
39
|
-
|
|
40
|
-
/** Returns a wrapped function that returns a stub with tracing enabled */
|
|
41
32
|
function wrapCreateStub(origCreate) {
|
|
42
|
-
return async function
|
|
33
|
+
return async function(...args) {
|
|
43
34
|
const servicePath = args[1]?.servicePath;
|
|
44
|
-
if (servicePath == null || servicePath ==
|
|
35
|
+
if (servicePath == null || servicePath == void 0) {
|
|
45
36
|
return origCreate.apply(this, args);
|
|
46
37
|
}
|
|
47
38
|
const serviceIdentifier = identifyService(servicePath);
|
|
@@ -52,52 +43,40 @@ function wrapCreateStub(origCreate) {
|
|
|
52
43
|
return stub;
|
|
53
44
|
};
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
/** Patches the function in grpc stub to enable tracing */
|
|
57
46
|
function fillGrpcFunction(stub, serviceIdentifier, methodName) {
|
|
58
47
|
const funcObj = stub[methodName];
|
|
59
|
-
if (typeof funcObj !==
|
|
48
|
+
if (typeof funcObj !== "function") {
|
|
60
49
|
return;
|
|
61
50
|
}
|
|
62
|
-
const callType =
|
|
63
|
-
|
|
64
|
-
? 'unary call'
|
|
65
|
-
: funcObj.requestStream && !funcObj.responseStream
|
|
66
|
-
? 'client stream'
|
|
67
|
-
: !funcObj.requestStream && funcObj.responseStream
|
|
68
|
-
? 'server stream'
|
|
69
|
-
: 'bidi stream';
|
|
70
|
-
if (callType != 'unary call') {
|
|
51
|
+
const callType = !funcObj.requestStream && !funcObj.responseStream ? "unary call" : funcObj.requestStream && !funcObj.responseStream ? "client stream" : !funcObj.requestStream && funcObj.responseStream ? "server stream" : "bidi stream";
|
|
52
|
+
if (callType != "unary call") {
|
|
71
53
|
return;
|
|
72
54
|
}
|
|
73
55
|
fill(
|
|
74
56
|
stub,
|
|
75
57
|
methodName,
|
|
76
|
-
(orig) =>
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
if (typeof ret?.on !== 'function' || !SETUP_CLIENTS.has(getClient() )) {
|
|
80
|
-
return ret;
|
|
81
|
-
}
|
|
82
|
-
const span = startInactiveSpan({
|
|
83
|
-
name: `${callType} ${methodName}`,
|
|
84
|
-
onlyIfParent: true,
|
|
85
|
-
op: `grpc.${serviceIdentifier}`,
|
|
86
|
-
attributes: {
|
|
87
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
ret.on('status', () => {
|
|
91
|
-
if (span) {
|
|
92
|
-
span.end();
|
|
93
|
-
}
|
|
94
|
-
});
|
|
58
|
+
(orig) => (...args) => {
|
|
59
|
+
const ret = orig.apply(stub, args);
|
|
60
|
+
if (typeof ret?.on !== "function" || !SETUP_CLIENTS.has(getClient())) {
|
|
95
61
|
return ret;
|
|
96
|
-
}
|
|
62
|
+
}
|
|
63
|
+
const span = startInactiveSpan({
|
|
64
|
+
name: `${callType} ${methodName}`,
|
|
65
|
+
onlyIfParent: true,
|
|
66
|
+
op: `grpc.${serviceIdentifier}`,
|
|
67
|
+
attributes: {
|
|
68
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.grpc.serverless"
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
ret.on("status", () => {
|
|
72
|
+
if (span) {
|
|
73
|
+
span.end();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return ret;
|
|
77
|
+
}
|
|
97
78
|
);
|
|
98
79
|
}
|
|
99
|
-
|
|
100
|
-
/** Identifies service by its address */
|
|
101
80
|
function identifyService(servicePath) {
|
|
102
81
|
const match = servicePath.match(SERVICE_PATH_REGEX);
|
|
103
82
|
return match?.[1] || servicePath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface GrpcFunctionObject extends GrpcFunction {\n requestStream: boolean;\n responseStream: boolean;\n originalName: string;\n}\n\ninterface StubOptions {\n servicePath?: string;\n}\n\ninterface CreateStubFunc extends CallableFunction {\n (createStub: unknown, options: StubOptions): PromiseLike<Stub>;\n}\n\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc';\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudGrpcIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const gaxModule = require('google-gax');\n fill(\n gaxModule.GrpcClient.prototype, // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n 'createStub',\n wrapCreateStub,\n );\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for GRPC APIs.\n */\nexport const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);\n\n/** Returns a wrapped function that returns a stub with tracing enabled */\nfunction wrapCreateStub(origCreate: CreateStubFunc): CreateStubFunc {\n return async function (this: unknown, ...args: Parameters<CreateStubFunc>) {\n const servicePath = args[1]?.servicePath;\n if (servicePath == null || servicePath == undefined) {\n return origCreate.apply(this, args);\n }\n const serviceIdentifier = identifyService(servicePath);\n const stub = await origCreate.apply(this, args);\n for (const methodName of Object.keys(Object.getPrototypeOf(stub))) {\n fillGrpcFunction(stub, serviceIdentifier, methodName);\n }\n return stub;\n };\n}\n\n/** Patches the function in grpc stub to enable tracing */\nexport function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void {\n const funcObj = stub[methodName];\n if (typeof funcObj !== 'function') {\n return;\n }\n const callType =\n !funcObj.requestStream && !funcObj.responseStream\n ? 'unary call'\n : funcObj.requestStream && !funcObj.responseStream\n ? 'client stream'\n : !funcObj.requestStream && funcObj.responseStream\n ? 'server stream'\n : 'bidi stream';\n if (callType != 'unary call') {\n return;\n }\n fill(\n stub,\n methodName,\n (orig: GrpcFunction): GrpcFunction =>\n (...args) => {\n const ret = orig.apply(stub, args);\n if (typeof ret?.on !== 'function' || !SETUP_CLIENTS.has(getClient() as Client)) {\n return ret;\n }\n const span = startInactiveSpan({\n name: `${callType} ${methodName}`,\n onlyIfParent: true,\n op: `grpc.${serviceIdentifier}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',\n },\n });\n ret.on('status', () => {\n if (span) {\n span.end();\n }\n });\n return ret;\n },\n );\n}\n\n/** Identifies service by its address */\nfunction identifyService(servicePath: string): string {\n const match = servicePath.match(SERVICE_PATH_REGEX);\n return match?.[1] || servicePath;\n}\n"],"names":[],"mappings":";;;AA2BA,MAAM,kBAAA,GAAqB,
|
|
1
|
+
{"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface GrpcFunctionObject extends GrpcFunction {\n requestStream: boolean;\n responseStream: boolean;\n originalName: string;\n}\n\ninterface StubOptions {\n servicePath?: string;\n}\n\ninterface CreateStubFunc extends CallableFunction {\n (createStub: unknown, options: StubOptions): PromiseLike<Stub>;\n}\n\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc';\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudGrpcIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const gaxModule = require('google-gax');\n fill(\n gaxModule.GrpcClient.prototype, // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n 'createStub',\n wrapCreateStub,\n );\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for GRPC APIs.\n */\nexport const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);\n\n/** Returns a wrapped function that returns a stub with tracing enabled */\nfunction wrapCreateStub(origCreate: CreateStubFunc): CreateStubFunc {\n return async function (this: unknown, ...args: Parameters<CreateStubFunc>) {\n const servicePath = args[1]?.servicePath;\n if (servicePath == null || servicePath == undefined) {\n return origCreate.apply(this, args);\n }\n const serviceIdentifier = identifyService(servicePath);\n const stub = await origCreate.apply(this, args);\n for (const methodName of Object.keys(Object.getPrototypeOf(stub))) {\n fillGrpcFunction(stub, serviceIdentifier, methodName);\n }\n return stub;\n };\n}\n\n/** Patches the function in grpc stub to enable tracing */\nexport function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void {\n const funcObj = stub[methodName];\n if (typeof funcObj !== 'function') {\n return;\n }\n const callType =\n !funcObj.requestStream && !funcObj.responseStream\n ? 'unary call'\n : funcObj.requestStream && !funcObj.responseStream\n ? 'client stream'\n : !funcObj.requestStream && funcObj.responseStream\n ? 'server stream'\n : 'bidi stream';\n if (callType != 'unary call') {\n return;\n }\n fill(\n stub,\n methodName,\n (orig: GrpcFunction): GrpcFunction =>\n (...args) => {\n const ret = orig.apply(stub, args);\n if (typeof ret?.on !== 'function' || !SETUP_CLIENTS.has(getClient() as Client)) {\n return ret;\n }\n const span = startInactiveSpan({\n name: `${callType} ${methodName}`,\n onlyIfParent: true,\n op: `grpc.${serviceIdentifier}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',\n },\n });\n ret.on('status', () => {\n if (span) {\n span.end();\n }\n });\n return ret;\n },\n );\n}\n\n/** Identifies service by its address */\nfunction identifyService(servicePath: string): string {\n const match = servicePath.match(SERVICE_PATH_REGEX);\n return match?.[1] || servicePath;\n}\n"],"names":[],"mappings":";;;AA2BA,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,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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,19 +1,16 @@
|
|
|
1
1
|
import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan } from '@sentry/core';
|
|
2
2
|
import { startInactiveSpan } from '@sentry/node';
|
|
3
3
|
|
|
4
|
-
const INTEGRATION_NAME =
|
|
5
|
-
|
|
6
|
-
const SETUP_CLIENTS = new WeakMap();
|
|
7
|
-
|
|
4
|
+
const INTEGRATION_NAME = "GoogleCloudHttp";
|
|
5
|
+
const SETUP_CLIENTS = /* @__PURE__ */ new WeakMap();
|
|
8
6
|
const _googleCloudHttpIntegration = ((options = {}) => {
|
|
9
7
|
const optional = options.optional || false;
|
|
10
8
|
return {
|
|
11
9
|
name: INTEGRATION_NAME,
|
|
12
10
|
setupOnce() {
|
|
13
11
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
fill(commonModule.Service.prototype, 'request', wrapRequestFunction);
|
|
12
|
+
const commonModule = require("@google-cloud/common");
|
|
13
|
+
fill(commonModule.Service.prototype, "request", wrapRequestFunction);
|
|
17
14
|
} catch (e) {
|
|
18
15
|
if (!optional) {
|
|
19
16
|
throw e;
|
|
@@ -22,40 +19,30 @@ const _googleCloudHttpIntegration = ((options = {}) => {
|
|
|
22
19
|
},
|
|
23
20
|
setup(client) {
|
|
24
21
|
SETUP_CLIENTS.set(client, true);
|
|
25
|
-
}
|
|
22
|
+
}
|
|
26
23
|
};
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Google Cloud Platform service requests tracking for RESTful APIs.
|
|
31
|
-
*/
|
|
24
|
+
});
|
|
32
25
|
const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);
|
|
33
|
-
|
|
34
|
-
/** Returns a wrapped function that makes a request with tracing enabled */
|
|
35
26
|
function wrapRequestFunction(orig) {
|
|
36
|
-
return function
|
|
37
|
-
const httpMethod = reqOpts.method ||
|
|
38
|
-
const span = SETUP_CLIENTS.has(getClient()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
: new SentryNonRecordingSpan();
|
|
27
|
+
return function(reqOpts, callback) {
|
|
28
|
+
const httpMethod = reqOpts.method || "GET";
|
|
29
|
+
const span = SETUP_CLIENTS.has(getClient()) ? startInactiveSpan({
|
|
30
|
+
name: `${httpMethod} ${reqOpts.uri}`,
|
|
31
|
+
onlyIfParent: true,
|
|
32
|
+
op: `http.client.${identifyService(this.apiEndpoint)}`,
|
|
33
|
+
attributes: {
|
|
34
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.serverless"
|
|
35
|
+
}
|
|
36
|
+
}) : new SentryNonRecordingSpan();
|
|
48
37
|
orig.call(this, reqOpts, (...args) => {
|
|
49
38
|
span.end();
|
|
50
39
|
callback(...args);
|
|
51
40
|
});
|
|
52
41
|
};
|
|
53
42
|
}
|
|
54
|
-
|
|
55
|
-
/** Identifies service by its base url */
|
|
56
43
|
function identifyService(apiEndpoint) {
|
|
57
44
|
const match = apiEndpoint.match(/^https:\/\/(\w+)\.googleapis.com$/);
|
|
58
|
-
return match?.[1] || apiEndpoint.replace(/^(http|https)?:\/\//,
|
|
45
|
+
return match?.[1] || apiEndpoint.replace(/^(http|https)?:\/\//, "");
|
|
59
46
|
}
|
|
60
47
|
|
|
61
48
|
export { googleCloudHttpIntegration };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-cloud-http.js","sources":["../../../src/integrations/google-cloud-http.ts"],"sourcesContent":["import type * as common from '@google-cloud/common';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\n\ntype RequestOptions = common.DecorateRequestOptions;\ntype ResponseCallback = common.BodyResponseCallback;\n// This interace could be replaced with just type alias once the `strictBindCallApply` mode is enabled.\ninterface RequestFunction extends CallableFunction {\n (reqOpts: RequestOptions, callback: ResponseCallback): void;\n}\n\nconst INTEGRATION_NAME = 'GoogleCloudHttp';\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudHttpIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const commonModule = require('@google-cloud/common') as typeof common;\n fill(commonModule.Service.prototype, 'request', wrapRequestFunction);\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for RESTful APIs.\n */\nexport const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);\n\n/** Returns a wrapped function that makes a request with tracing enabled */\nfunction wrapRequestFunction(orig: RequestFunction): RequestFunction {\n return function (this: common.Service, reqOpts: RequestOptions, callback: ResponseCallback): void {\n const httpMethod = reqOpts.method || 'GET';\n const span = SETUP_CLIENTS.has(getClient() as Client)\n ? startInactiveSpan({\n name: `${httpMethod} ${reqOpts.uri}`,\n onlyIfParent: true,\n op: `http.client.${identifyService(this.apiEndpoint)}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n },\n })\n : new SentryNonRecordingSpan();\n orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {\n span.end();\n callback(...args);\n });\n };\n}\n\n/** Identifies service by its base url */\nfunction identifyService(apiEndpoint: string): string {\n const match = apiEndpoint.match(/^https:\\/\\/(\\w+)\\.googleapis.com$/);\n return match?.[1] || apiEndpoint.replace(/^(http|https)?:\\/\\//, '');\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,gBAAA,GAAmB,
|
|
1
|
+
{"version":3,"file":"google-cloud-http.js","sources":["../../../src/integrations/google-cloud-http.ts"],"sourcesContent":["import type * as common from '@google-cloud/common';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\n\ntype RequestOptions = common.DecorateRequestOptions;\ntype ResponseCallback = common.BodyResponseCallback;\n// This interace could be replaced with just type alias once the `strictBindCallApply` mode is enabled.\ninterface RequestFunction extends CallableFunction {\n (reqOpts: RequestOptions, callback: ResponseCallback): void;\n}\n\nconst INTEGRATION_NAME = 'GoogleCloudHttp';\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudHttpIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const commonModule = require('@google-cloud/common') as typeof common;\n fill(commonModule.Service.prototype, 'request', wrapRequestFunction);\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for RESTful APIs.\n */\nexport const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);\n\n/** Returns a wrapped function that makes a request with tracing enabled */\nfunction wrapRequestFunction(orig: RequestFunction): RequestFunction {\n return function (this: common.Service, reqOpts: RequestOptions, callback: ResponseCallback): void {\n const httpMethod = reqOpts.method || 'GET';\n const span = SETUP_CLIENTS.has(getClient() as Client)\n ? startInactiveSpan({\n name: `${httpMethod} ${reqOpts.uri}`,\n onlyIfParent: true,\n op: `http.client.${identifyService(this.apiEndpoint)}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n },\n })\n : new SentryNonRecordingSpan();\n orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {\n span.end();\n callback(...args);\n });\n };\n}\n\n/** Identifies service by its base url */\nfunction identifyService(apiEndpoint: string): string {\n const match = apiEndpoint.match(/^https:\\/\\/(\\w+)\\.googleapis.com$/);\n return match?.[1] || apiEndpoint.replace(/^(http|https)?:\\/\\//, '');\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,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,OAAO,aAAA,CAAc,GAAA,CAAI,SAAA,EAAqB,IAChD,iBAAA,CAAkB;AAAA,MAChB,IAAA,EAAM,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,QAAQ,GAAG,CAAA,CAAA;AAAA,MAClC,YAAA,EAAc,IAAA;AAAA,MACd,EAAA,EAAI,CAAA,YAAA,EAAe,eAAA,CAAgB,IAAA,CAAK,WAAW,CAAC,CAAA,CAAA;AAAA,MACpD,UAAA,EAAY;AAAA,QACV,CAAC,gCAAgC,GAAG;AAAA;AACtC,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,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,mCAAmC,CAAA;AACnE,EAAA,OAAO,QAAQ,CAAC,CAAA,IAAK,WAAA,CAAY,OAAA,CAAQ,uBAAuB,EAAE,CAAA;AACpE;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"10.
|
|
1
|
+
{"type":"module","version":"10.54.0","sideEffects":false}
|
package/build/esm/sdk.js
CHANGED
|
@@ -1,34 +1,27 @@
|
|
|
1
1
|
import { applySdkMetadata } from '@sentry/core';
|
|
2
2
|
import { getDefaultIntegrationsWithoutPerformance, init as init$1 } from '@sentry/node';
|
|
3
3
|
import { isCjs } from '@sentry/node-core';
|
|
4
|
+
import { gcpContextIntegration } from './integrations/gcp-context.js';
|
|
4
5
|
import { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc.js';
|
|
5
6
|
import { googleCloudHttpIntegration } from './integrations/google-cloud-http.js';
|
|
6
7
|
|
|
7
8
|
function getCjsOnlyIntegrations() {
|
|
8
|
-
return isCjs()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
return isCjs() ? [
|
|
10
|
+
googleCloudHttpIntegration({ optional: true }),
|
|
11
|
+
// We mark this integration optional since '@google-cloud/common' module could be missing.
|
|
12
|
+
googleCloudGrpcIntegration({ optional: true })
|
|
13
|
+
// We mark this integration optional since 'google-gax' module could be missing.
|
|
14
|
+
] : [];
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
/** Get the default integrations for the GCP SDK. */
|
|
17
16
|
function getDefaultIntegrations(_options) {
|
|
18
|
-
return [...getDefaultIntegrationsWithoutPerformance(), ...getCjsOnlyIntegrations()];
|
|
17
|
+
return [...getDefaultIntegrationsWithoutPerformance(), gcpContextIntegration(), ...getCjsOnlyIntegrations()];
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @see {@link Sentry.init}
|
|
23
|
-
*/
|
|
24
19
|
function init(options = {}) {
|
|
25
20
|
const opts = {
|
|
26
21
|
defaultIntegrations: getDefaultIntegrations(),
|
|
27
|
-
...options
|
|
22
|
+
...options
|
|
28
23
|
};
|
|
29
|
-
|
|
30
|
-
applySdkMetadata(opts, 'google-cloud-serverless', ['google-cloud-serverless', 'node']);
|
|
31
|
-
|
|
24
|
+
applySdkMetadata(opts, "google-cloud-serverless", ["google-cloud-serverless", "node"]);
|
|
32
25
|
return init$1(opts);
|
|
33
26
|
}
|
|
34
27
|
|
package/build/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { getDefaultIntegrationsWithoutPerformance, init as initNode } from '@sentry/node';\nimport { isCjs } from '@sentry/node-core';\nimport { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';\nimport { googleCloudHttpIntegration } from './integrations/google-cloud-http';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs()\n ? [\n googleCloudHttpIntegration({ optional: true }), // We mark this integration optional since '@google-cloud/common' module could be missing.\n googleCloudGrpcIntegration({ optional: true }), // We mark this integration optional since 'google-gax' module could be missing.\n ]\n : [];\n}\n\n/** Get the default integrations for the GCP SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n return [...getDefaultIntegrationsWithoutPerformance(), ...getCjsOnlyIntegrations()];\n}\n\n/**\n * @see {@link Sentry.init}\n */\nexport function init(options: NodeOptions = {}): NodeClient | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'google-cloud-serverless', ['google-cloud-serverless', 'node']);\n\n return initNode(opts);\n}\n"],"names":["initNode"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport type { NodeClient, NodeOptions } from '@sentry/node';\nimport { getDefaultIntegrationsWithoutPerformance, init as initNode } from '@sentry/node';\nimport { isCjs } from '@sentry/node-core';\nimport { gcpContextIntegration } from './integrations/gcp-context';\nimport { googleCloudGrpcIntegration } from './integrations/google-cloud-grpc';\nimport { googleCloudHttpIntegration } from './integrations/google-cloud-http';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs()\n ? [\n googleCloudHttpIntegration({ optional: true }), // We mark this integration optional since '@google-cloud/common' module could be missing.\n googleCloudGrpcIntegration({ optional: true }), // We mark this integration optional since 'google-gax' module could be missing.\n ]\n : [];\n}\n\n/** Get the default integrations for the GCP SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n return [...getDefaultIntegrationsWithoutPerformance(), gcpContextIntegration(), ...getCjsOnlyIntegrations()];\n}\n\n/**\n * @see {@link Sentry.init}\n */\nexport function init(options: NodeOptions = {}): NodeClient | undefined {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(options),\n ...options,\n };\n\n applySdkMetadata(opts, 'google-cloud-serverless', ['google-cloud-serverless', 'node']);\n\n return initNode(opts);\n}\n"],"names":["initNode"],"mappings":";;;;;;;AASA,SAAS,sBAAA,GAAwC;AAC/C,EAAA,OAAO,OAAM,GACT;AAAA,IACE,0BAAA,CAA2B,EAAE,QAAA,EAAU,IAAA,EAAM,CAAA;AAAA;AAAA,IAC7C,0BAAA,CAA2B,EAAE,QAAA,EAAU,IAAA,EAAM;AAAA;AAAA,MAE/C,EAAC;AACP;AAGO,SAAS,uBAAuB,QAAA,EAAkC;AACvE,EAAA,OAAO,CAAC,GAAG,wCAAA,EAAyC,EAAG,uBAAsB,EAAG,GAAG,wBAAwB,CAAA;AAC7G;AAKO,SAAS,IAAA,CAAK,OAAA,GAAuB,EAAC,EAA2B;AACtE,EAAA,MAAM,IAAA,GAAO;AAAA,IACX,mBAAA,EAAqB,uBAA8B,CAAA;AAAA,IACnD,GAAG;AAAA,GACL;AAEA,EAAA,gBAAA,CAAiB,IAAA,EAAM,yBAAA,EAA2B,CAAC,yBAAA,EAA2B,MAAM,CAAC,CAAA;AAErF,EAAA,OAAOA,OAAS,IAAI,CAAA;AACtB;;;;"}
|
package/build/esm/utils.js
CHANGED
|
@@ -1,53 +1,30 @@
|
|
|
1
1
|
import { withIsolationScope, addExceptionMechanism } from '@sentry/core';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @param fn function to run
|
|
5
|
-
* @returns function which runs in the newly created domain or in the existing one
|
|
6
|
-
*/
|
|
7
3
|
function domainify(fn) {
|
|
8
4
|
return (...args) => withIsolationScope(() => fn(...args));
|
|
9
5
|
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param source function to be wrapped
|
|
13
|
-
* @param wrap wrapping function that takes source and returns a wrapper
|
|
14
|
-
* @param overrides properties to override in the source
|
|
15
|
-
* @returns wrapped function
|
|
16
|
-
*/
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
function proxyFunction(
|
|
19
|
-
source,
|
|
20
|
-
wrap,
|
|
21
|
-
overrides,
|
|
22
|
-
) {
|
|
6
|
+
function proxyFunction(source, wrap, overrides) {
|
|
23
7
|
const wrapper = wrap(source);
|
|
24
8
|
const handler = {
|
|
25
9
|
apply: (_target, thisArg, args) => {
|
|
26
10
|
return wrapper.apply(thisArg, args);
|
|
27
|
-
}
|
|
11
|
+
}
|
|
28
12
|
};
|
|
29
|
-
|
|
30
13
|
if (overrides) {
|
|
31
14
|
handler.get = (target, prop) => {
|
|
32
15
|
if (Object.prototype.hasOwnProperty.call(overrides, prop)) {
|
|
33
|
-
return overrides[prop
|
|
16
|
+
return overrides[prop];
|
|
34
17
|
}
|
|
35
|
-
return
|
|
18
|
+
return target[prop];
|
|
36
19
|
};
|
|
37
20
|
}
|
|
38
|
-
|
|
39
21
|
return new Proxy(source, handler);
|
|
40
22
|
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Marks an event as unhandled by adding a span processor to the passed scope.
|
|
44
|
-
*/
|
|
45
23
|
function markEventUnhandled(scope, type) {
|
|
46
|
-
scope.addEventProcessor(event => {
|
|
24
|
+
scope.addEventProcessor((event) => {
|
|
47
25
|
addExceptionMechanism(event, { handled: false, type });
|
|
48
26
|
return event;
|
|
49
27
|
});
|
|
50
|
-
|
|
51
28
|
return scope;
|
|
52
29
|
}
|
|
53
30
|
|
package/build/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import type { Scope } from '@sentry/core';\nimport { addExceptionMechanism, withIsolationScope } from '@sentry/core';\n\n/**\n * @param fn function to run\n * @returns function which runs in the newly created domain or in the existing one\n */\nexport function domainify<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R | void {\n return (...args) => withIsolationScope(() => fn(...args));\n}\n\n/**\n * @param source function to be wrapped\n * @param wrap wrapping function that takes source and returns a wrapper\n * @param overrides properties to override in the source\n * @returns wrapped function\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function proxyFunction<A extends any[], R, F extends (...args: A) => R>(\n source: F,\n wrap: (source: F) => F,\n overrides?: Record<PropertyKey, unknown>,\n): F {\n const wrapper = wrap(source);\n const handler: ProxyHandler<F> = {\n apply: <T>(_target: F, thisArg: T, args: A) => {\n return wrapper.apply(thisArg, args);\n },\n };\n\n if (overrides) {\n handler.get = (target, prop) => {\n if (Object.prototype.hasOwnProperty.call(overrides, prop)) {\n return overrides[prop as string];\n }\n return (target as Record<PropertyKey, unknown>)[prop as string];\n };\n }\n\n return new Proxy(source, handler);\n}\n\n/**\n * Marks an event as unhandled by adding a span processor to the passed scope.\n */\nexport function markEventUnhandled(scope: Scope, type: string): Scope {\n scope.addEventProcessor(event => {\n addExceptionMechanism(event, { handled: false, type });\n return event;\n });\n\n return scope;\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import type { Scope } from '@sentry/core';\nimport { addExceptionMechanism, withIsolationScope } from '@sentry/core';\n\n/**\n * @param fn function to run\n * @returns function which runs in the newly created domain or in the existing one\n */\nexport function domainify<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R | void {\n return (...args) => withIsolationScope(() => fn(...args));\n}\n\n/**\n * @param source function to be wrapped\n * @param wrap wrapping function that takes source and returns a wrapper\n * @param overrides properties to override in the source\n * @returns wrapped function\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function proxyFunction<A extends any[], R, F extends (...args: A) => R>(\n source: F,\n wrap: (source: F) => F,\n overrides?: Record<PropertyKey, unknown>,\n): F {\n const wrapper = wrap(source);\n const handler: ProxyHandler<F> = {\n apply: <T>(_target: F, thisArg: T, args: A) => {\n return wrapper.apply(thisArg, args);\n },\n };\n\n if (overrides) {\n handler.get = (target, prop) => {\n if (Object.prototype.hasOwnProperty.call(overrides, prop)) {\n return overrides[prop as string];\n }\n return (target as Record<PropertyKey, unknown>)[prop as string];\n };\n }\n\n return new Proxy(source, handler);\n}\n\n/**\n * Marks an event as unhandled by adding a span processor to the passed scope.\n */\nexport function markEventUnhandled(scope: Scope, type: string): Scope {\n scope.addEventProcessor(event => {\n addExceptionMechanism(event, { handled: false, type });\n return event;\n });\n\n return scope;\n}\n"],"names":[],"mappings":";;AAOO,SAAS,UAAkC,EAAA,EAAiD;AACjG,EAAA,OAAO,IAAI,IAAA,KAAS,kBAAA,CAAmB,MAAM,EAAA,CAAG,GAAG,IAAI,CAAC,CAAA;AAC1D;AASO,SAAS,aAAA,CACd,MAAA,EACA,IAAA,EACA,SAAA,EACG;AACH,EAAA,MAAM,OAAA,GAAU,KAAK,MAAM,CAAA;AAC3B,EAAA,MAAM,OAAA,GAA2B;AAAA,IAC/B,KAAA,EAAO,CAAI,OAAA,EAAY,OAAA,EAAY,IAAA,KAAY;AAC7C,MAAA,OAAO,OAAA,CAAQ,KAAA,CAAM,OAAA,EAAS,IAAI,CAAA;AAAA,IACpC;AAAA,GACF;AAEA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAA,CAAQ,GAAA,GAAM,CAAC,MAAA,EAAQ,IAAA,KAAS;AAC9B,MAAA,IAAI,OAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAAK,SAAA,EAAW,IAAI,CAAA,EAAG;AACzD,QAAA,OAAO,UAAU,IAAc,CAAA;AAAA,MACjC;AACA,MAAA,OAAQ,OAAwC,IAAc,CAAA;AAAA,IAChE,CAAA;AAAA,EACF;AAEA,EAAA,OAAO,IAAI,KAAA,CAAM,MAAA,EAAQ,OAAO,CAAA;AAClC;AAKO,SAAS,kBAAA,CAAmB,OAAc,IAAA,EAAqB;AACpE,EAAA,KAAA,CAAM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