@@ -14,7 +14,7 @@ import {
14
14
import type { TransactionSource } from '@sentry/types' ;
15
15
import { getSanitizedUrlString , parseUrl , stripUrlQueryAndFragment } from '@sentry/utils' ;
16
16
17
- import { SEMANTIC_ATTRIBUTE_CACHE_HIT } from '@sentry/core' ;
17
+ import { SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core' ;
18
18
import type { AbstractSpan } from '../types' ;
19
19
import { getSpanKind } from './getSpanKind' ;
20
20
import { spanHasAttributes , spanHasName } from './spanTypes' ;
@@ -44,9 +44,14 @@ export function parseSpanDescription(span: AbstractSpan): SpanDescription {
44
44
return descriptionForHttpMethod ( { attributes, name, kind : getSpanKind ( span ) } , httpMethod ) ;
45
45
}
46
46
47
- // If db.type exists then this is a database call span (unless it is cache)
48
47
const dbSystem = attributes [ SEMATTRS_DB_SYSTEM ] ;
49
- if ( dbSystem && typeof attributes [ SEMANTIC_ATTRIBUTE_CACHE_HIT ] !== 'boolean' ) {
48
+ const opIsCache =
49
+ typeof attributes [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] === 'string' &&
50
+ attributes [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] . startsWith ( 'cache.' ) ;
51
+
52
+ // If db.type exists then this is a database call span
53
+ // If the Redis DB is used as a cache, the span description should not be changed
54
+ if ( dbSystem && ( ! attributes [ SEMANTIC_ATTRIBUTE_SENTRY_OP ] || ! opIsCache ) ) {
50
55
return descriptionForDbSystem ( { attributes, name } ) ;
51
56
}
52
57
0 commit comments