From 9b6c6d145b2b7474ee6ba9d74cd7a02e49895d92 Mon Sep 17 00:00:00 2001 From: Martin Sonnberger Date: Mon, 27 Jul 2026 15:42:37 +0200 Subject: [PATCH 1/3] feat(google-cloud-serverless)!: Use `grpc` span op for GCP gRPC calls The service suffix fragmented grouping and was unbounded for non- `googleapis.com` service paths. Service identity moves to `rpc.service`, with `rpc.system.name` and `rpc.method` added alongside. Ref: JS-3105 Co-Authored-By: Claude Opus 5 (1M context) --- packages/google-cloud-serverless/package.json | 1 + .../src/integrations/google-cloud-grpc.ts | 7 ++++++- .../test/integrations/google-cloud-grpc.test.ts | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) 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..011bfe6e47e7 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 } 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}`, + op: FAAS_GRPC_SPAN_OP, attributes: { [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..a5742c87893d 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 @@ -142,9 +142,12 @@ describe('GoogleCloudGrpc tracing', () => { expect(mockStartInactiveSpan).toHaveBeenCalledWith({ name: 'unary call unaryMethod', onlyIfParent: true, - op: 'grpc.test-service', + op: 'grpc', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', + 'rpc.system.name': 'grpc', + 'rpc.service': 'test-service', + 'rpc.method': 'unaryMethod', }, }); }); From 1af70d933fa01681b2812241df454a70b8e07997 Mon Sep 17 00:00:00 2001 From: Martin Sonnberger Date: Tue, 28 Jul 2026 14:23:49 +0200 Subject: [PATCH 2/3] use sentry.op --- .../src/integrations/google-cloud-grpc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 011bfe6e47e7..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,4 +1,4 @@ -import { RPC_METHOD, RPC_SERVICE, RPC_SYSTEM_NAME } from '@sentry/conventions/attributes'; +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'; @@ -108,8 +108,8 @@ export function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodNa const span = startInactiveSpan({ name: `${callType} ${methodName}`, onlyIfParent: true, - op: FAAS_GRPC_SPAN_OP, attributes: { + [SENTRY_OP]: FAAS_GRPC_SPAN_OP, [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', [RPC_SYSTEM_NAME]: 'grpc', [RPC_SERVICE]: serviceIdentifier, From 2460c36eb1cc64043fdc25f2810a7c1948995185 Mon Sep 17 00:00:00 2001 From: Martin Sonnberger Date: Tue, 28 Jul 2026 14:35:29 +0200 Subject: [PATCH 3/3] fix test --- .../test/integrations/google-cloud-grpc.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 a5742c87893d..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,8 +143,8 @@ describe('GoogleCloudGrpc tracing', () => { expect(mockStartInactiveSpan).toHaveBeenCalledWith({ name: 'unary call unaryMethod', onlyIfParent: true, - op: 'grpc', attributes: { + [SENTRY_OP]: 'grpc', [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.grpc.serverless', 'rpc.system.name': 'grpc', 'rpc.service': 'test-service',