@sentry/google-cloud-serverless 10.62.0 → 10.63.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.
@@ -1 +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":["getCurrentScope","safeSetSpanJSONAttributes","defineIntegration"],"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,aAAaA,oBAAA,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,MAAAC,8BAAA,CAA0B,MAAM,KAAK,CAAA;AAAA,IACvC;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,qBAAA,GAAwBC,uBAAkB,sBAAsB;;;;"}
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' as const,\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":["getCurrentScope","safeSetSpanJSONAttributes","defineIntegration"],"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,aAAaA,oBAAA,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,MAAAC,8BAAA,CAA0B,MAAM,KAAK,CAAA;AAAA,IACvC;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,qBAAA,GAAwBC,uBAAkB,sBAAsB;;;;"}
@@ -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":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;AA2BA,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,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MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACJ;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;;"}
1
+ {"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface GrpcFunctionObject extends GrpcFunction {\n requestStream: boolean;\n responseStream: boolean;\n originalName: string;\n}\n\ninterface StubOptions {\n servicePath?: string;\n}\n\ninterface CreateStubFunc extends CallableFunction {\n (createStub: unknown, options: StubOptions): PromiseLike<Stub>;\n}\n\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc' as const;\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudGrpcIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const gaxModule = require('google-gax');\n fill(\n gaxModule.GrpcClient.prototype, // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n 'createStub',\n wrapCreateStub,\n );\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for GRPC APIs.\n */\nexport const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);\n\n/** Returns a wrapped function that returns a stub with tracing enabled */\nfunction wrapCreateStub(origCreate: CreateStubFunc): CreateStubFunc {\n return async function (this: unknown, ...args: Parameters<CreateStubFunc>) {\n const servicePath = args[1]?.servicePath;\n if (servicePath == null || servicePath == undefined) {\n return origCreate.apply(this, args);\n }\n const serviceIdentifier = identifyService(servicePath);\n const stub = await origCreate.apply(this, args);\n for (const methodName of Object.keys(Object.getPrototypeOf(stub))) {\n fillGrpcFunction(stub, serviceIdentifier, methodName);\n }\n return stub;\n };\n}\n\n/** Patches the function in grpc stub to enable tracing */\nexport function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void {\n const funcObj = stub[methodName];\n if (typeof funcObj !== 'function') {\n return;\n }\n const callType =\n !funcObj.requestStream && !funcObj.responseStream\n ? 'unary call'\n : funcObj.requestStream && !funcObj.responseStream\n ? 'client stream'\n : !funcObj.requestStream && funcObj.responseStream\n ? 'server stream'\n : 'bidi stream';\n if (callType != 'unary call') {\n return;\n }\n fill(\n stub,\n methodName,\n (orig: GrpcFunction): GrpcFunction =>\n (...args) => {\n const ret = orig.apply(stub, args);\n if (typeof ret?.on !== 'function' || !SETUP_CLIENTS.has(getClient() as Client)) {\n return ret;\n }\n const span = startInactiveSpan({\n name: `${callType} ${methodName}`,\n onlyIfParent: true,\n op: `grpc.${serviceIdentifier}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',\n },\n });\n ret.on('status', () => {\n if (span) {\n span.end();\n }\n });\n return ret;\n },\n );\n}\n\n/** Identifies service by its address */\nfunction identifyService(servicePath: string): string {\n const match = servicePath.match(SERVICE_PATH_REGEX);\n return match?.[1] || servicePath;\n}\n"],"names":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN"],"mappings":";;;;;AA2BA,MAAM,kBAAA,GAAqB,yBAAA;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AAA,IAAI,IAAA,EAAM;AACR,UAAA,IAAA,CAAK,GAAA,EAAI;AAAA,QACX;AAAA,MACF,CAAC,CAAA;AACD,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACJ;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;;"}
@@ -1 +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":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SentryNonRecordingSpan"],"mappings":";;;;;AAkBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;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,SAAyB,QAAA,EAAkC;AAChG,IAAA,MAAM,UAAA,GAAa,QAAQ,MAAA,IAAU,KAAA;AACrC,IAAA,MAAM,OAAO,aAAA,CAAc,GAAA,CAAIC,cAAA,EAAqB,IAChDC,sBAAA,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,CAACC,qCAAgC,GAAG;AAAA;AACtC,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,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,mCAAmC,CAAA;AACnE,EAAA,OAAO,QAAQ,CAAC,CAAA,IAAK,WAAA,CAAY,OAAA,CAAQ,uBAAuB,EAAE,CAAA;AACpE;;;;"}
1
+ {"version":3,"file":"google-cloud-http.js","sources":["../../../src/integrations/google-cloud-http.ts"],"sourcesContent":["import type * as common from '@google-cloud/common';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\n\ntype RequestOptions = common.DecorateRequestOptions;\ntype ResponseCallback = common.BodyResponseCallback;\n// This interace could be replaced with just type alias once the `strictBindCallApply` mode is enabled.\ninterface RequestFunction extends CallableFunction {\n (reqOpts: RequestOptions, callback: ResponseCallback): void;\n}\n\nconst INTEGRATION_NAME = 'GoogleCloudHttp' as const;\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudHttpIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const commonModule = require('@google-cloud/common') as typeof common;\n fill(commonModule.Service.prototype, 'request', wrapRequestFunction);\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for RESTful APIs.\n */\nexport const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);\n\n/** Returns a wrapped function that makes a request with tracing enabled */\nfunction wrapRequestFunction(orig: RequestFunction): RequestFunction {\n return function (this: common.Service, reqOpts: RequestOptions, callback: ResponseCallback): void {\n const httpMethod = reqOpts.method || 'GET';\n const span = SETUP_CLIENTS.has(getClient() as Client)\n ? startInactiveSpan({\n name: `${httpMethod} ${reqOpts.uri}`,\n onlyIfParent: true,\n op: `http.client.${identifyService(this.apiEndpoint)}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n },\n })\n : new SentryNonRecordingSpan();\n orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {\n span.end();\n callback(...args);\n });\n };\n}\n\n/** Identifies service by its base url */\nfunction identifyService(apiEndpoint: string): string {\n const match = apiEndpoint.match(/^https:\\/\\/(\\w+)\\.googleapis.com$/);\n return match?.[1] || apiEndpoint.replace(/^(http|https)?:\\/\\//, '');\n}\n"],"names":["fill","defineIntegration","getClient","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SentryNonRecordingSpan"],"mappings":";;;;;AAkBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;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,SAAyB,QAAA,EAAkC;AAChG,IAAA,MAAM,UAAA,GAAa,QAAQ,MAAA,IAAU,KAAA;AACrC,IAAA,MAAM,OAAO,aAAA,CAAc,GAAA,CAAIC,cAAA,EAAqB,IAChDC,sBAAA,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,CAACC,qCAAgC,GAAG;AAAA;AACtC,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,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,mCAAmC,CAAA;AACnE,EAAA,OAAO,QAAQ,CAAC,CAAA,IAAK,WAAA,CAAY,OAAA,CAAQ,uBAAuB,EAAE,CAAA;AACpE;;;;"}
@@ -1 +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;;;;"}
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' as const,\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;;;;"}
@@ -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,yBAAA;AAE3B,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,IAAI;AAEF,QAAA,MAAM,SAAA,GAAY,QAAQ,YAAY,CAAA;AACtC,QAAA,IAAA;AAAA,UACE,UAAU,UAAA,CAAW,SAAA;AAAA;AAAA,UACrB,YAAA;AAAA,UACA;AAAA,SACF;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,CAAC,QAAA,EAAU;AACb,UAAA,MAAM,CAAA;AAAA,QACR;AAAA,MACF;AAAA,IACF,CAAA;AAAA,IACA,MAAM,MAAA,EAAQ;AACZ,MAAA,aAAA,CAAc,GAAA,CAAI,QAAQ,IAAI,CAAA;AAAA,IAChC;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,0BAAA,GAA6B,kBAAkB,2BAA2B;AAGvF,SAAS,eAAe,UAAA,EAA4C;AAClE,EAAA,OAAO,kBAAkC,IAAA,EAAkC;AACzE,IAAA,MAAM,WAAA,GAAc,IAAA,CAAK,CAAC,CAAA,EAAG,WAAA;AAC7B,IAAA,IAAI,WAAA,IAAe,IAAA,IAAQ,WAAA,IAAe,MAAA,EAAW;AACnD,MAAA,OAAO,UAAA,CAAW,KAAA,CAA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QAAQ,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA;AAAA,QAC/B,YAAA,EAAc,IAAA;AAAA,QACd,EAAA,EAAI,QAAQ,iBAAiB,CAAA,CAAA;AAAA,QAC7B,UAAA,EAAY;AAAA,UACV,CAAC,gCAAgC,GAAG;AAAA;AACtC,OACD,CAAA;AACD,MAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,IAAA,CAAK,GAAA,EAAI;AAAA,QACX;AAAA,MACF,CAAC,CAAA;AACD,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACJ;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;"}
1
+ {"version":3,"file":"google-cloud-grpc.js","sources":["../../../src/integrations/google-cloud-grpc.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\nimport type { EventEmitter } from 'events';\n\nexport interface GrpcFunction extends CallableFunction {\n (...args: unknown[]): EventEmitter;\n}\n\nexport interface GrpcFunctionObject extends GrpcFunction {\n requestStream: boolean;\n responseStream: boolean;\n originalName: string;\n}\n\ninterface StubOptions {\n servicePath?: string;\n}\n\ninterface CreateStubFunc extends CallableFunction {\n (createStub: unknown, options: StubOptions): PromiseLike<Stub>;\n}\n\nexport interface Stub {\n [key: string]: GrpcFunctionObject;\n}\n\nconst SERVICE_PATH_REGEX = /^(\\w+)\\.googleapis.com$/;\n\nconst INTEGRATION_NAME = 'GoogleCloudGrpc' as const;\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudGrpcIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const gaxModule = require('google-gax');\n fill(\n gaxModule.GrpcClient.prototype, // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n 'createStub',\n wrapCreateStub,\n );\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for GRPC APIs.\n */\nexport const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);\n\n/** Returns a wrapped function that returns a stub with tracing enabled */\nfunction wrapCreateStub(origCreate: CreateStubFunc): CreateStubFunc {\n return async function (this: unknown, ...args: Parameters<CreateStubFunc>) {\n const servicePath = args[1]?.servicePath;\n if (servicePath == null || servicePath == undefined) {\n return origCreate.apply(this, args);\n }\n const serviceIdentifier = identifyService(servicePath);\n const stub = await origCreate.apply(this, args);\n for (const methodName of Object.keys(Object.getPrototypeOf(stub))) {\n fillGrpcFunction(stub, serviceIdentifier, methodName);\n }\n return stub;\n };\n}\n\n/** Patches the function in grpc stub to enable tracing */\nexport function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void {\n const funcObj = stub[methodName];\n if (typeof funcObj !== 'function') {\n return;\n }\n const callType =\n !funcObj.requestStream && !funcObj.responseStream\n ? 'unary call'\n : funcObj.requestStream && !funcObj.responseStream\n ? 'client stream'\n : !funcObj.requestStream && funcObj.responseStream\n ? 'server stream'\n : 'bidi stream';\n if (callType != 'unary call') {\n return;\n }\n fill(\n stub,\n methodName,\n (orig: GrpcFunction): GrpcFunction =>\n (...args) => {\n const ret = orig.apply(stub, args);\n if (typeof ret?.on !== 'function' || !SETUP_CLIENTS.has(getClient() as Client)) {\n return ret;\n }\n const span = startInactiveSpan({\n name: `${callType} ${methodName}`,\n onlyIfParent: true,\n op: `grpc.${serviceIdentifier}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless',\n },\n });\n ret.on('status', () => {\n if (span) {\n span.end();\n }\n });\n return ret;\n },\n );\n}\n\n/** Identifies service by its address */\nfunction identifyService(servicePath: string): string {\n const match = servicePath.match(SERVICE_PATH_REGEX);\n return match?.[1] || servicePath;\n}\n"],"names":[],"mappings":";;;AA2BA,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,GAAW,QAAQ,QAAA,IAAY,KAAA;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,IAAI;AAEF,QAAA,MAAM,SAAA,GAAY,QAAQ,YAAY,CAAA;AACtC,QAAA,IAAA;AAAA,UACE,UAAU,UAAA,CAAW,SAAA;AAAA;AAAA,UACrB,YAAA;AAAA,UACA;AAAA,SACF;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,CAAC,QAAA,EAAU;AACb,UAAA,MAAM,CAAA;AAAA,QACR;AAAA,MACF;AAAA,IACF,CAAA;AAAA,IACA,MAAM,MAAA,EAAQ;AACZ,MAAA,aAAA,CAAc,GAAA,CAAI,QAAQ,IAAI,CAAA;AAAA,IAChC;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,0BAAA,GAA6B,kBAAkB,2BAA2B;AAGvF,SAAS,eAAe,UAAA,EAA4C;AAClE,EAAA,OAAO,kBAAkC,IAAA,EAAkC;AACzE,IAAA,MAAM,WAAA,GAAc,IAAA,CAAK,CAAC,CAAA,EAAG,WAAA;AAC7B,IAAA,IAAI,WAAA,IAAe,IAAA,IAAQ,WAAA,IAAe,MAAA,EAAW;AACnD,MAAA,OAAO,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AA,EAAM,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,UAAU,CAAA,CAAA;AAAA,QAC/B,YAAA,EAAc,IAAA;AAAA,QACd,EAAA,EAAI,QAAQ,iBAAiB,CAAA,CAAA;AAAA,QAC7B,UAAA,EAAY;AAAA,UACV,CAAC,gCAAgC,GAAG;AAAA;AACtC,OACD,CAAA;AACD,MAAA,GAAA,CAAI,EAAA,CAAG,UAAU,MAAM;AACrB,QAAA,IAAI,IAAA,EAAM;AACR,UAAA,IAAA,CAAK,GAAA,EAAI;AAAA,QACX;AAAA,MACF,CAAC,CAAA;AACD,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACJ;AACF;AAGA,SAAS,gBAAgB,WAAA,EAA6B;AACpD,EAAA,MAAM,KAAA,GAAQ,WAAA,CAAY,KAAA,CAAM,kBAAkB,CAAA;AAClD,EAAA,OAAO,KAAA,GAAQ,CAAC,CAAA,IAAK,WAAA;AACvB;;;;"}
@@ -1 +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,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,OAA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CAAY,OAAA,CAAQ,uBAAuB,EAAE,CAAA;AACpE;;;;"}
1
+ {"version":3,"file":"google-cloud-http.js","sources":["../../../src/integrations/google-cloud-http.ts"],"sourcesContent":["import type * as common from '@google-cloud/common';\nimport type { Client, IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n fill,\n getClient,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/node';\n\ntype RequestOptions = common.DecorateRequestOptions;\ntype ResponseCallback = common.BodyResponseCallback;\n// This interace could be replaced with just type alias once the `strictBindCallApply` mode is enabled.\ninterface RequestFunction extends CallableFunction {\n (reqOpts: RequestOptions, callback: ResponseCallback): void;\n}\n\nconst INTEGRATION_NAME = 'GoogleCloudHttp' as const;\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _googleCloudHttpIntegration = ((options: { optional?: boolean } = {}) => {\n const optional = options.optional || false;\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const commonModule = require('@google-cloud/common') as typeof common;\n fill(commonModule.Service.prototype, 'request', wrapRequestFunction);\n } catch (e) {\n if (!optional) {\n throw e;\n }\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Google Cloud Platform service requests tracking for RESTful APIs.\n */\nexport const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);\n\n/** Returns a wrapped function that makes a request with tracing enabled */\nfunction wrapRequestFunction(orig: RequestFunction): RequestFunction {\n return function (this: common.Service, reqOpts: RequestOptions, callback: ResponseCallback): void {\n const httpMethod = reqOpts.method || 'GET';\n const span = SETUP_CLIENTS.has(getClient() as Client)\n ? startInactiveSpan({\n name: `${httpMethod} ${reqOpts.uri}`,\n onlyIfParent: true,\n op: `http.client.${identifyService(this.apiEndpoint)}`,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.serverless',\n },\n })\n : new SentryNonRecordingSpan();\n orig.call(this, reqOpts, (...args: Parameters<ResponseCallback>) => {\n span.end();\n callback(...args);\n });\n };\n}\n\n/** Identifies service by its base url */\nfunction identifyService(apiEndpoint: string): string {\n const match = apiEndpoint.match(/^https:\\/\\/(\\w+)\\.googleapis.com$/);\n return match?.[1] || apiEndpoint.replace(/^(http|https)?:\\/\\//, '');\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,gBAAA,GAAmB,iBAAA;AAEzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,2BAAA,IAA+B,CAAC,OAAA,GAAkC,EAAC,KAAM;AAC7E,EAAA,MAAM,QAAA,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;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.62.0","sideEffects":false}
1
+ {"type":"module","version":"10.63.0","sideEffects":false}
@@ -1,2 +1,4 @@
1
- export declare const gcpContextIntegration: () => import("@sentry/core").Integration;
1
+ export declare const gcpContextIntegration: () => import("@sentry/core").Integration & {
2
+ name: "GcpContext";
3
+ };
2
4
  //# sourceMappingURL=gcp-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gcp-context.d.ts","sourceRoot":"","sources":["../../../src/integrations/gcp-context.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,qBAAqB,0CAA4C,CAAC"}
1
+ {"version":3,"file":"gcp-context.d.ts","sourceRoot":"","sources":["../../../src/integrations/gcp-context.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,qBAAqB;;CAA4C,CAAC"}
@@ -15,7 +15,9 @@ export interface Stub {
15
15
  */
16
16
  export declare const googleCloudGrpcIntegration: (options?: {
17
17
  optional?: boolean;
18
- } | undefined) => import("@sentry/core").Integration;
18
+ } | undefined) => import("@sentry/core").Integration & {
19
+ name: "GoogleCloudGrpc";
20
+ };
19
21
  /** Patches the function in grpc stub to enable tracing */
20
22
  export declare function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void;
21
23
  //# sourceMappingURL=google-cloud-grpc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"google-cloud-grpc.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-grpc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;CACpC;AAED,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD,MAAM,WAAW,IAAI;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACnC;AAiCD;;GAEG;AACH,eAAO,MAAM,0BAA0B;eA5BqB,OAAO;oDA4BqB,CAAC;AAkBzF,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAyChG"}
1
+ {"version":3,"file":"google-cloud-grpc.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-grpc.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;CACpC;AAED,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD,MAAM,WAAW,IAAI;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACnC;AAiCD;;GAEG;AACH,eAAO,MAAM,0BAA0B;eA5BqB,OAAO;;;CA4BqB,CAAC;AAkBzF,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAyChG"}
@@ -3,5 +3,7 @@
3
3
  */
4
4
  export declare const googleCloudHttpIntegration: (options?: {
5
5
  optional?: boolean;
6
- } | undefined) => import("@sentry/core").Integration;
6
+ } | undefined) => import("@sentry/core").Integration & {
7
+ name: "GoogleCloudHttp";
8
+ };
7
9
  //# sourceMappingURL=google-cloud-http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"google-cloud-http.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-http.ts"],"names":[],"mappings":"AA2CA;;GAEG;AACH,eAAO,MAAM,0BAA0B;eAxBqB,OAAO;oDAwBqB,CAAC"}
1
+ {"version":3,"file":"google-cloud-http.d.ts","sourceRoot":"","sources":["../../../src/integrations/google-cloud-http.ts"],"names":[],"mappings":"AA2CA;;GAEG;AACH,eAAO,MAAM,0BAA0B;eAxBqB,OAAO;;;CAwBqB,CAAC"}
@@ -1,2 +1,4 @@
1
- export declare const gcpContextIntegration: () => import("@sentry/core").Integration;
1
+ export declare const gcpContextIntegration: () => import("@sentry/core").Integration & {
2
+ name: "GcpContext";
3
+ };
2
4
  //# sourceMappingURL=gcp-context.d.ts.map
@@ -15,7 +15,9 @@ export interface Stub {
15
15
  */
16
16
  export declare const googleCloudGrpcIntegration: (options?: {
17
17
  optional?: boolean;
18
- } | undefined) => import("@sentry/core").Integration;
18
+ } | undefined) => import("@sentry/core").Integration & {
19
+ name: "GoogleCloudGrpc";
20
+ };
19
21
  /** Patches the function in grpc stub to enable tracing */
20
22
  export declare function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: string): void;
21
23
  //# sourceMappingURL=google-cloud-grpc.d.ts.map
@@ -3,5 +3,7 @@
3
3
  */
4
4
  export declare const googleCloudHttpIntegration: (options?: {
5
5
  optional?: boolean;
6
- } | undefined) => import("@sentry/core").Integration;
6
+ } | undefined) => import("@sentry/core").Integration & {
7
+ name: "GoogleCloudHttp";
8
+ };
7
9
  //# sourceMappingURL=google-cloud-http.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/google-cloud-serverless",
3
- "version": "10.62.0",
3
+ "version": "10.63.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",
@@ -48,9 +48,9 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@sentry/core": "10.62.0",
52
- "@sentry/node": "10.62.0",
53
- "@sentry/node-core": "10.62.0"
51
+ "@sentry/core": "10.63.0",
52
+ "@sentry/node": "10.63.0",
53
+ "@sentry/node-core": "10.63.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@google-cloud/bigquery": "^5.3.0",