diff --git a/packages/google-cloud-serverless/package.json b/packages/google-cloud-serverless/package.json index 31e6a3d823b2..893c6c9b3894 100644 --- a/packages/google-cloud-serverless/package.json +++ b/packages/google-cloud-serverless/package.json @@ -41,6 +41,7 @@ "access": "public" }, "dependencies": { + "@sentry/conventions": "^0.16.0", "@sentry/core": "10.67.0", "@sentry/node": "10.67.0" }, diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts index 4f5fee645e1b..4063bfdfd9db 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts @@ -1,3 +1,5 @@ +import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME, SENTRY_OP } from '@sentry/conventions/attributes'; +import { FAAS_GRPC_SPAN_OP } from '@sentry/conventions/op'; import type { Client, IntegrationFn } from '@sentry/core'; import { defineIntegration, fill, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; @@ -106,9 +108,12 @@ export function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodNa const span = startInactiveSpan({ name: `${callType} ${methodName}`, onlyIfParent: true, - op: `grpc.${serviceIdentifier}`, attributes: { + [SENTRY_OP]: FAAS_GRPC_SPAN_OP, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', + [RPC_SYSTEM_NAME]: 'grpc', + [RPC_SERVICE]: serviceIdentifier, + [RPC_METHOD]: methodName, }, }); ret.on('status', () => { diff --git a/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts b/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts index 1419f05b4323..954f186a34d4 100644 --- a/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts +++ b/packages/google-cloud-serverless/test/integrations/google-cloud-grpc.test.ts @@ -1,3 +1,4 @@ +import { SENTRY_OP } from '@sentry/conventions/attributes'; import { createTransport, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setCurrentClient } from '@sentry/core'; import { NodeClient } from '@sentry/node'; import { beforeEach, describe, expect, test, vi } from 'vitest'; @@ -142,9 +143,12 @@ describe('GoogleCloudGrpc tracing', () => { expect(mockStartInactiveSpan).toHaveBeenCalledWith({ name: 'unary call unaryMethod', onlyIfParent: true, - op: 'grpc.test-service', attributes: { + [SENTRY_OP]: 'grpc', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', + 'rpc.system.name': 'grpc', + 'rpc.service': 'test-service', + 'rpc.method': 'unaryMethod', }, }); });