@@ -33,18 +33,21 @@ import { PACKAGE_NAME, PACKAGE_VERSION } from '../version';
3333import type { RedisCommand , RedisPluginClientTypes } from './internal-types' ;
3434import { Attributes , SpanKind , context , trace } from '@opentelemetry/api' ;
3535import {
36- DBSYSTEMVALUES_REDIS ,
37- SEMATTRS_DB_CONNECTION_STRING ,
38- SEMATTRS_DB_STATEMENT ,
39- SEMATTRS_DB_SYSTEM ,
40- SEMATTRS_NET_PEER_NAME ,
41- SEMATTRS_NET_PEER_PORT ,
4236 ATTR_DB_SYSTEM_NAME ,
4337 ATTR_DB_QUERY_TEXT ,
4438 ATTR_DB_OPERATION_NAME ,
4539 ATTR_SERVER_ADDRESS ,
4640 ATTR_SERVER_PORT ,
4741} from '@opentelemetry/semantic-conventions' ;
42+ import {
43+ ATTR_DB_CONNECTION_STRING ,
44+ ATTR_DB_STATEMENT ,
45+ ATTR_DB_SYSTEM ,
46+ ATTR_NET_PEER_NAME ,
47+ ATTR_NET_PEER_PORT ,
48+ DB_SYSTEM_NAME_VALUE_REDIS ,
49+ DB_SYSTEM_VALUE_REDIS ,
50+ } from '../semconv' ;
4851import { defaultDbStatementSerializer } from '@opentelemetry/redis-common' ;
4952
5053export class RedisInstrumentationV2_V3 extends InstrumentationBase < RedisInstrumentationConfig > {
@@ -156,17 +159,14 @@ export class RedisInstrumentationV2_V3 extends InstrumentationBase<RedisInstrume
156159
157160 if ( instrumentation . _semconvStability & SemconvStability . OLD ) {
158161 Object . assign ( attributes , {
159- [ SEMATTRS_DB_SYSTEM ] : DBSYSTEMVALUES_REDIS ,
160- [ SEMATTRS_DB_STATEMENT ] : dbStatementSerializer (
161- cmd . command ,
162- cmd . args
163- ) ,
162+ [ ATTR_DB_SYSTEM ] : DB_SYSTEM_VALUE_REDIS ,
163+ [ ATTR_DB_STATEMENT ] : dbStatementSerializer ( cmd . command , cmd . args ) ,
164164 } ) ;
165165 }
166166
167167 if ( instrumentation . _semconvStability & SemconvStability . STABLE ) {
168168 Object . assign ( attributes , {
169- [ ATTR_DB_SYSTEM_NAME ] : 'redis' ,
169+ [ ATTR_DB_SYSTEM_NAME ] : DB_SYSTEM_NAME_VALUE_REDIS ,
170170 [ ATTR_DB_OPERATION_NAME ] : cmd . command ,
171171 [ ATTR_DB_QUERY_TEXT ] : dbStatementSerializer ( cmd . command , cmd . args ) ,
172172 } ) ;
@@ -186,8 +186,8 @@ export class RedisInstrumentationV2_V3 extends InstrumentationBase<RedisInstrume
186186
187187 if ( instrumentation . _semconvStability & SemconvStability . OLD ) {
188188 Object . assign ( connectionAttributes , {
189- [ SEMATTRS_NET_PEER_NAME ] : this . connection_options . host ,
190- [ SEMATTRS_NET_PEER_PORT ] : this . connection_options . port ,
189+ [ ATTR_NET_PEER_NAME ] : this . connection_options . host ,
190+ [ ATTR_NET_PEER_PORT ] : this . connection_options . port ,
191191 } ) ;
192192 }
193193
@@ -206,7 +206,7 @@ export class RedisInstrumentationV2_V3 extends InstrumentationBase<RedisInstrume
206206 instrumentation . _semconvStability & SemconvStability . OLD
207207 ) {
208208 span . setAttribute (
209- SEMATTRS_DB_CONNECTION_STRING ,
209+ ATTR_DB_CONNECTION_STRING ,
210210 `redis://${ this . address } `
211211 ) ;
212212 }
0 commit comments