diff --git a/dev-packages/e2e-tests/test-applications/deno-redis/src/app.ts b/dev-packages/e2e-tests/test-applications/deno-redis/src/app.ts index 31e27c1ce7bb..0a8622503322 100644 --- a/dev-packages/e2e-tests/test-applications/deno-redis/src/app.ts +++ b/dev-packages/e2e-tests/test-applications/deno-redis/src/app.ts @@ -56,7 +56,7 @@ Deno.serve({ port, hostname: '0.0.0.0' }, async (req: Request) => { } // node-redis: SET then GET — exercises two commands inside a single - // transaction so we can assert the parent has two db.redis children. + // transaction so we can assert the parent has two db.query children. if (url.pathname === '/redis-set-get') { const key = url.searchParams.get('key') ?? 'cache:key'; const value = url.searchParams.get('value') ?? 'hello'; @@ -89,7 +89,7 @@ Deno.serve({ port, hostname: '0.0.0.0' }, async (req: Request) => { // ioredis: MULTI — ioredis has no separate batch channel; per-command // payloads carry `batchMode`/`batchSize` instead, so we still expect one - // db.redis span per command. + // db.query span per command. if (url.pathname === '/ioredis-multi') { const result = await ioredis.multi().set('iomulti:a', '1').set('iomulti:b', '2').get('iomulti:a').exec(); return Response.json({ result }); diff --git a/dev-packages/e2e-tests/test-applications/deno-redis/tests/ioredis.test.ts b/dev-packages/e2e-tests/test-applications/deno-redis/tests/ioredis.test.ts index 49a53850634b..0268bfc8e794 100644 --- a/dev-packages/e2e-tests/test-applications/deno-redis/tests/ioredis.test.ts +++ b/dev-packages/e2e-tests/test-applications/deno-redis/tests/ioredis.test.ts @@ -1,7 +1,7 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -test('ioredis GET emits an http.server transaction containing a db.redis child span', async ({ baseURL }) => { +test('ioredis GET emits an http.server transaction containing a db.query child span', async ({ baseURL }) => { // Each incoming request gets a Sentry http.server transaction (via the // default denoServeIntegration); the ioredis command runs inside it, so the // child span attaches to that transaction. @@ -9,7 +9,7 @@ test('ioredis GET emits an http.server transaction containing a db.redis child s return ( event?.contexts?.trace?.op === 'http.server' && (event.request?.url ?? '').includes('/ioredis-get') && - (event.spans?.some(span => span.op === 'db.redis') ?? false) + (event.spans?.some(span => span.op === 'db.query') ?? false) ); }); @@ -18,7 +18,7 @@ test('ioredis GET emits an http.server transaction containing a db.redis child s await res.json(); const transaction = await transactionPromise; - const redisSpan = transaction.spans!.find(span => span.op === 'db.redis'); + const redisSpan = transaction.spans!.find(span => span.op === 'db.query'); expect(redisSpan).toBeDefined(); // ioredis publishes lowercase command names; node-redis publishes uppercase. expect(redisSpan!.description).toBe('redis-get'); @@ -26,12 +26,12 @@ test('ioredis GET emits an http.server transaction containing a db.redis child s expect(redisSpan!.data?.['db.query.text']).toBe('get iocache:user:42'); }); -test('ioredis SET then GET emit two db.redis child spans on the same transaction', async ({ baseURL }) => { +test('ioredis SET then GET emit two db.query child spans on the same transaction', async ({ baseURL }) => { const transactionPromise = waitForTransaction('deno-redis', event => { return ( event?.contexts?.trace?.op === 'http.server' && (event.request?.url ?? '').includes('/ioredis-set-get') && - (event.spans?.filter(span => span.op === 'db.redis').length ?? 0) >= 2 + (event.spans?.filter(span => span.op === 'db.query').length ?? 0) >= 2 ); }); @@ -40,14 +40,14 @@ test('ioredis SET then GET emit two db.redis child spans on the same transaction await res.json(); const transaction = await transactionPromise; - const redisSpans = transaction.spans!.filter(span => span.op === 'db.redis'); + const redisSpans = transaction.spans!.filter(span => span.op === 'db.query'); expect(redisSpans.length).toBeGreaterThanOrEqual(2); const ops = redisSpans.map(s => s.description); expect(ops).toContain('redis-set'); expect(ops).toContain('redis-get'); }); -test('ioredis MULTI emits one db.redis span per command (no batch channel)', async ({ baseURL }) => { +test('ioredis MULTI emits one db.query span per command (no batch channel)', async ({ baseURL }) => { // ioredis does not publish to a batch channel — each command in the // transaction publishes individually with batchMode/batchSize set on its // own payload. So the transaction should contain multiple `redis-` @@ -56,7 +56,7 @@ test('ioredis MULTI emits one db.redis span per command (no batch channel)', asy return ( event?.contexts?.trace?.op === 'http.server' && (event.request?.url ?? '').includes('/ioredis-multi') && - (event.spans?.filter(span => span.op === 'db.redis').length ?? 0) >= 3 + (event.spans?.filter(span => span.op === 'db.query').length ?? 0) >= 3 ); }); @@ -65,7 +65,7 @@ test('ioredis MULTI emits one db.redis span per command (no batch channel)', asy await res.json(); const transaction = await transactionPromise; - const redisSpans = transaction.spans!.filter(span => span.op === 'db.redis'); + const redisSpans = transaction.spans!.filter(span => span.op === 'db.query'); expect(redisSpans.length).toBeGreaterThanOrEqual(3); const descriptions = redisSpans.map(s => s.description); expect(descriptions).toContain('redis-set'); @@ -75,12 +75,12 @@ test('ioredis MULTI emits one db.redis span per command (no batch channel)', asy expect(batchSpan).toBeUndefined(); }); -test('ioredis PIPELINE emits one db.redis span per command', async ({ baseURL }) => { +test('ioredis PIPELINE emits one db.query span per command', async ({ baseURL }) => { const transactionPromise = waitForTransaction('deno-redis', event => { return ( event?.contexts?.trace?.op === 'http.server' && (event.request?.url ?? '').includes('/ioredis-pipeline') && - (event.spans?.filter(span => span.op === 'db.redis').length ?? 0) >= 3 + (event.spans?.filter(span => span.op === 'db.query').length ?? 0) >= 3 ); }); @@ -89,6 +89,6 @@ test('ioredis PIPELINE emits one db.redis span per command', async ({ baseURL }) await res.json(); const transaction = await transactionPromise; - const redisSpans = transaction.spans!.filter(span => span.op === 'db.redis'); + const redisSpans = transaction.spans!.filter(span => span.op === 'db.query'); expect(redisSpans.length).toBeGreaterThanOrEqual(3); }); diff --git a/dev-packages/e2e-tests/test-applications/deno-redis/tests/redis.test.ts b/dev-packages/e2e-tests/test-applications/deno-redis/tests/redis.test.ts index a5fdcd1b74a1..66c3fb72ac43 100644 --- a/dev-packages/e2e-tests/test-applications/deno-redis/tests/redis.test.ts +++ b/dev-packages/e2e-tests/test-applications/deno-redis/tests/redis.test.ts @@ -1,7 +1,7 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; -test('GET command emits an http.server transaction containing a db.redis child span', async ({ baseURL }) => { +test('GET command emits an http.server transaction containing a db.query child span', async ({ baseURL }) => { // Each incoming request gets a Sentry http.server transaction (via the // default denoServeIntegration); the redis command runs inside it, so the // child span attaches to that transaction. @@ -9,7 +9,7 @@ test('GET command emits an http.server transaction containing a db.redis child s return ( event?.contexts?.trace?.op === 'http.server' && (event.request?.url ?? '').includes('/redis-get') && - (event.spans?.some(span => span.op === 'db.redis') ?? false) + (event.spans?.some(span => span.op === 'db.query') ?? false) ); }); @@ -18,7 +18,7 @@ test('GET command emits an http.server transaction containing a db.redis child s await res.json(); const transaction = await transactionPromise; - const redisSpan = transaction.spans!.find(span => span.op === 'db.redis'); + const redisSpan = transaction.spans!.find(span => span.op === 'db.query'); expect(redisSpan).toBeDefined(); expect(redisSpan!.description).toBe('redis-GET'); expect(redisSpan!.data?.['db.system.name']).toBe('redis'); @@ -27,12 +27,12 @@ test('GET command emits an http.server transaction containing a db.redis child s expect(redisSpan!.data?.['server.port']).toBe(6379); }); -test('SET then GET emit two db.redis child spans on the same transaction', async ({ baseURL }) => { +test('SET then GET emit two db.query child spans on the same transaction', async ({ baseURL }) => { const transactionPromise = waitForTransaction('deno-redis', event => { return ( event?.contexts?.trace?.op === 'http.server' && (event.request?.url ?? '').includes('/redis-set-get') && - (event.spans?.filter(span => span.op === 'db.redis').length ?? 0) >= 2 + (event.spans?.filter(span => span.op === 'db.query').length ?? 0) >= 2 ); }); @@ -41,7 +41,7 @@ test('SET then GET emit two db.redis child spans on the same transaction', async await res.json(); const transaction = await transactionPromise; - const redisSpans = transaction.spans!.filter(span => span.op === 'db.redis'); + const redisSpans = transaction.spans!.filter(span => span.op === 'db.query'); expect(redisSpans.length).toBeGreaterThanOrEqual(2); const ops = redisSpans.map(s => s.description); expect(ops).toContain('redis-SET'); @@ -64,7 +64,7 @@ test('MULTI batch emits a PIPELINE/MULTI batch span', async ({ baseURL }) => { const transaction = await transactionPromise; const batchSpan = transaction.spans!.find(span => span.description === 'MULTI' || span.description === 'PIPELINE'); expect(batchSpan).toBeDefined(); - expect(batchSpan!.op).toBe('db.redis'); + expect(batchSpan!.op).toBe('db.query'); expect(batchSpan!.data?.['db.system.name']).toBe('redis'); }); diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/redis.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/redis.server.test.ts index 5b9f141195ea..eb60915bd89c 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/redis.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework-instrumentation/tests/performance/redis.server.test.ts @@ -3,11 +3,11 @@ import { waitForTransaction } from '@sentry-internal/test-utils'; import { APP_NAME } from '../constants'; test.describe('server - redis db spans (instrumentation API)', () => { - test('OTel db.redis spans nest under the native instrumentation-API http.server transaction', async ({ page }) => { + test('OTel db.query spans nest under the native instrumentation-API http.server transaction', async ({ page }) => { const txPromise = waitForTransaction(APP_NAME, async transactionEvent => { return ( transactionEvent.transaction === 'GET /performance/redis' && - (transactionEvent.spans?.some(span => span.op === 'db.redis') ?? false) + (transactionEvent.spans?.some(span => span.op === 'db.query') ?? false) ); }); @@ -24,7 +24,7 @@ test.describe('server - redis db spans (instrumentation API)', () => { const rootSpanId = transaction.contexts?.trace?.span_id; const spanIds = new Set([rootSpanId, ...(transaction.spans ?? []).map(span => span.span_id)]); - const redisSpans = transaction.spans!.filter(span => span.op === 'db.redis'); + const redisSpans = transaction.spans!.filter(span => span.op === 'db.query'); // loader runs SET then GET => at least two redis command spans expect(redisSpans.length).toBeGreaterThanOrEqual(2); diff --git a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/redis.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/redis.server.test.ts index 1040902647c4..1b82a709ab7b 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/redis.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-7-framework/tests/performance/redis.server.test.ts @@ -3,11 +3,11 @@ import { waitForTransaction } from '@sentry-internal/test-utils'; import { APP_NAME } from '../constants'; test.describe('server - redis db spans', () => { - test('server loader emits db.redis child spans on the http.server transaction', async ({ page }) => { + test('server loader emits db.query child spans on the http.server transaction', async ({ page }) => { const txPromise = waitForTransaction(APP_NAME, async transactionEvent => { return ( transactionEvent.transaction === 'GET /performance/redis' && - (transactionEvent.spans?.some(span => span.op === 'db.redis') ?? false) + (transactionEvent.spans?.some(span => span.op === 'db.query') ?? false) ); }); @@ -21,7 +21,7 @@ test.describe('server - redis db spans', () => { const rootSpanId = transaction.contexts?.trace?.span_id; const spanIds = new Set([rootSpanId, ...(transaction.spans ?? []).map(span => span.span_id)]); - const redisSpans = transaction.spans!.filter(span => span.op === 'db.redis'); + const redisSpans = transaction.spans!.filter(span => span.op === 'db.query'); // loader runs SET then GET => at least two redis command spans expect(redisSpans.length).toBeGreaterThanOrEqual(2); diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/redis.server.test.ts b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/redis.server.test.ts index 1040902647c4..1b82a709ab7b 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/redis.server.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-8-framework/tests/performance/redis.server.test.ts @@ -3,11 +3,11 @@ import { waitForTransaction } from '@sentry-internal/test-utils'; import { APP_NAME } from '../constants'; test.describe('server - redis db spans', () => { - test('server loader emits db.redis child spans on the http.server transaction', async ({ page }) => { + test('server loader emits db.query child spans on the http.server transaction', async ({ page }) => { const txPromise = waitForTransaction(APP_NAME, async transactionEvent => { return ( transactionEvent.transaction === 'GET /performance/redis' && - (transactionEvent.spans?.some(span => span.op === 'db.redis') ?? false) + (transactionEvent.spans?.some(span => span.op === 'db.query') ?? false) ); }); @@ -21,7 +21,7 @@ test.describe('server - redis db spans', () => { const rootSpanId = transaction.contexts?.trace?.span_id; const spanIds = new Set([rootSpanId, ...(transaction.spans ?? []).map(span => span.span_id)]); - const redisSpans = transaction.spans!.filter(span => span.op === 'db.redis'); + const redisSpans = transaction.spans!.filter(span => span.op === 'db.query'); // loader runs SET then GET => at least two redis command spans expect(redisSpans.length).toBeGreaterThanOrEqual(2); diff --git a/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts b/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts index 61fe42a02738..39969e658748 100644 --- a/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts @@ -13,10 +13,10 @@ describeWithDockerCompose( transaction: 'Test Span IORedis 5.11 DC', spans: expect.arrayContaining([ expect.objectContaining({ - op: 'db.redis', + op: 'db.query', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + 'sentry.op': 'db.query', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'set dc-test-key ?', @@ -45,10 +45,10 @@ describeWithDockerCompose( }), }), expect.objectContaining({ - op: 'db.redis', + op: 'db.query', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + 'sentry.op': 'db.query', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'get dc-test-key', @@ -78,10 +78,10 @@ describeWithDockerCompose( }), }), expect.objectContaining({ - op: 'db.redis', + op: 'db.query', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + 'sentry.op': 'db.query', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'mget ? ? ?', diff --git a/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts b/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts index a29edf9287cf..a0376d2d8ed2 100644 --- a/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/redis-cache/test.ts @@ -168,7 +168,7 @@ describeWithDockerCompose('redis cache auto instrumentation', { workingDirectory ? [ expect.objectContaining({ description: 'MULTI', - op: 'db.redis', + op: 'db.query', origin: redisOrigin, data: expect.objectContaining({ 'sentry.origin': redisOrigin, @@ -286,7 +286,7 @@ describeWithDockerCompose('redis cache auto instrumentation', { workingDirectory // a failing command produces a span with an error status expect.objectContaining({ description: 'INCR redis-test-key', - op: 'db', + op: isOrchestrionEnabled() ? 'db.query' : 'db', status: 'internal_error', origin: redisOrigin, data: expect.objectContaining({ @@ -321,7 +321,7 @@ describeWithDockerCompose('redis cache auto instrumentation', { workingDirectory ? [ expect.objectContaining({ description: 'MULTI', - op: 'db.redis', + op: 'db.query', origin: redisOrigin, data: expect.objectContaining({ 'sentry.origin': redisOrigin, @@ -439,7 +439,7 @@ describeWithDockerCompose('redis cache auto instrumentation', { workingDirectory // a failing command produces a span with an error status expect.objectContaining({ description: 'INCR redis-5-test-key', - op: 'db', + op: isOrchestrionEnabled() ? 'db.query' : 'db', status: 'internal_error', origin: redisOrigin, data: expect.objectContaining({ diff --git a/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts b/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts index 5f5336d2185b..d97db9ae92fe 100644 --- a/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts @@ -13,10 +13,10 @@ describeWithDockerCompose( transaction: 'Test Span Redis 5 DC', spans: expect.arrayContaining([ expect.objectContaining({ - op: 'db.redis', + op: 'db.query', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + 'sentry.op': 'db.query', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'SET dc-test-key ?', @@ -47,10 +47,10 @@ describeWithDockerCompose( }), }), expect.objectContaining({ - op: 'db.redis', + op: 'db.query', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + 'sentry.op': 'db.query', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'GET dc-test-key', @@ -82,12 +82,12 @@ describeWithDockerCompose( }), }), // MGET: node-redis sanitizes args for diagnostics_channel (keys become '?'), - // so cache detection cannot match prefixes — remains a plain db.redis span. + // so cache detection cannot match prefixes — remains a plain db.query span. expect.objectContaining({ - op: 'db.redis', + op: 'db.query', origin: 'auto.db.redis.diagnostic_channel', data: expect.objectContaining({ - 'sentry.op': 'db.redis', + 'sentry.op': 'db.query', 'sentry.origin': 'auto.db.redis.diagnostic_channel', 'db.system.name': 'redis', 'db.query.text': 'MGET ? ? ?', diff --git a/packages/deno/test/deno-redis.test.ts b/packages/deno/test/deno-redis.test.ts index c16d9283b8b9..601826a3054a 100644 --- a/packages/deno/test/deno-redis.test.ts +++ b/packages/deno/test/deno-redis.test.ts @@ -61,7 +61,7 @@ Deno.test('denoRedisIntegration: included in default integrations', () => { assert(names.includes('DenoRedis'), `DenoRedis should be in defaults, got ${names.join(', ')}`); }); -Deno.test('denoRedisIntegration: node-redis:command channel produces a db.redis child span', async () => { +Deno.test('denoRedisIntegration: node-redis:command channel produces a db.query child span', async () => { resetGlobals(); const sink = transactionSink(); init({ @@ -90,8 +90,8 @@ Deno.test('denoRedisIntegration: node-redis:command channel produces a db.redis "'parent' transaction", ); - const redisSpan = parent.spans?.find(s => s.op === 'db.redis'); - assertExists(redisSpan, `expected a db.redis child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`); + const redisSpan = parent.spans?.find(s => s.op === 'db.query'); + assertExists(redisSpan, `expected a db.query child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`); assertEquals(redisSpan!.description, 'redis-GET'); assertEquals(redisSpan!.data?.['db.system.name'], 'redis'); assertEquals(redisSpan!.data?.['db.query.text'], 'GET cache:key'); @@ -126,8 +126,8 @@ Deno.test('denoRedisIntegration: errors on the command channel set span status', 5000, "'parent' transaction", ); - const redisSpan = parent.spans?.find(s => s.op === 'db.redis'); - assertExists(redisSpan, `expected a db.redis child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`); + const redisSpan = parent.spans?.find(s => s.op === 'db.query'); + assertExists(redisSpan, `expected a db.query child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`); // Sentry serializes a span with `setStatus({ code: SPAN_STATUS_ERROR, message: 'X' })` // as `status: 'X'` (the message takes the slot). Both "not ok" and the // forwarded message confirm the error path fired. @@ -135,7 +135,7 @@ Deno.test('denoRedisIntegration: errors on the command channel set span status', assertEquals(redisSpan!.status, 'internal_error'); }); -Deno.test('denoRedisIntegration: ioredis:command channel produces a db.redis child span', async () => { +Deno.test('denoRedisIntegration: ioredis:command channel produces a db.query child span', async () => { resetGlobals(); const sink = transactionSink(); init({ @@ -162,8 +162,8 @@ Deno.test('denoRedisIntegration: ioredis:command channel produces a db.redis chi "'parent' transaction", ); - const redisSpan = parent.spans?.find(s => s.op === 'db.redis'); - assertExists(redisSpan, `expected a db.redis child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`); + const redisSpan = parent.spans?.find(s => s.op === 'db.query'); + assertExists(redisSpan, `expected a db.query child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`); assertEquals(redisSpan!.description, 'redis-get'); assertEquals(redisSpan!.data?.['db.system.name'], 'redis'); assertEquals(redisSpan!.data?.['db.query.text'], 'get cache:key'); diff --git a/packages/server-utils/src/integrations/tracing-channel/redis.ts b/packages/server-utils/src/integrations/tracing-channel/redis.ts index 42f23341b419..bb8c075b3bb1 100644 --- a/packages/server-utils/src/integrations/tracing-channel/redis.ts +++ b/packages/server-utils/src/integrations/tracing-channel/redis.ts @@ -13,6 +13,7 @@ import { SERVER_ADDRESS, SERVER_PORT, } from '@sentry/conventions/attributes'; +import { DATABASE_DB_QUERY_SPAN_OP, DATABASE_DB_SPAN_OP } from '@sentry/conventions/op'; import type { IntegrationFn, Span, SpanAttributes } from '@sentry/core'; import { isObjectLike, @@ -148,7 +149,7 @@ function startCommandSpan(commandName: string, commandArgs: Array 1 ? { [DB_OPERATION_BATCH_SIZE]: size } : {}), ...(socket?.host != null ? { [SERVER_ADDRESS]: socket.host } : {}), diff --git a/packages/server-utils/src/redis/redis-dc-subscriber.ts b/packages/server-utils/src/redis/redis-dc-subscriber.ts index 860f61138ae8..ce32bd1ec993 100644 --- a/packages/server-utils/src/redis/redis-dc-subscriber.ts +++ b/packages/server-utils/src/redis/redis-dc-subscriber.ts @@ -1,11 +1,13 @@ import type { TracingChannel } from 'node:diagnostics_channel'; import { DB_OPERATION_BATCH_SIZE, + DB_OPERATION_NAME, DB_QUERY_TEXT, DB_SYSTEM_NAME, SERVER_ADDRESS, SERVER_PORT, } from '@sentry/conventions/attributes'; +import { DATABASE_DB_QUERY_SPAN_OP, DATABASE_DB_SPAN_OP } from '@sentry/conventions/op'; import type { Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../tracing-channel'; @@ -155,8 +157,9 @@ function setupCommandChannel( name: `redis-${data.command}`, attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis', + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: DATABASE_DB_QUERY_SPAN_OP, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, + [DB_OPERATION_NAME]: data.command, [DB_QUERY_TEXT]: statement, ...(data.serverAddress != null ? { [SERVER_ADDRESS]: data.serverAddress } : {}), ...(data.serverPort != null ? { [SERVER_PORT]: data.serverPort } : {}), @@ -182,7 +185,7 @@ function setupBatchChannel( name: getOperationName(data), attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis', + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: DATABASE_DB_QUERY_SPAN_OP, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, // should only include batch size greater than 1, // or else it isn't properly considered a "batch" @@ -200,7 +203,7 @@ function setupConnectChannel(tracingChannel: RedisTracingChannelFactory, channel name: 'redis-connect', attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db.redis.connect', + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: DATABASE_DB_SPAN_OP, [DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS, ...(data.serverAddress != null ? { [SERVER_ADDRESS]: data.serverAddress } : {}), ...(data.serverPort != null ? { [SERVER_PORT]: data.serverPort } : {}),