@@ -30,10 +30,7 @@ import {
30
30
DbStatementSerializer ,
31
31
} from './types' ;
32
32
import { IORedisInstrumentation } from './ioredis' ;
33
- import {
34
- DatabaseAttribute ,
35
- GeneralAttribute ,
36
- } from '@opentelemetry/semantic-conventions' ;
33
+ import { SemanticAttributes } from '@opentelemetry/semantic-conventions' ;
37
34
import { safeExecuteInTheMiddle } from '@opentelemetry/instrumentation' ;
38
35
39
36
const endSpan = ( span : Span , err : NodeJS . ErrnoException | null | undefined ) => {
@@ -52,16 +49,16 @@ export const traceConnection = (tracer: Tracer, original: Function) => {
52
49
const span = tracer . startSpan ( 'connect' , {
53
50
kind : SpanKind . CLIENT ,
54
51
attributes : {
55
- [ DatabaseAttribute . DB_SYSTEM ] : IORedisInstrumentation . DB_SYSTEM ,
56
- [ DatabaseAttribute . DB_STATEMENT ] : 'connect' ,
52
+ [ SemanticAttributes . DB_SYSTEM ] : IORedisInstrumentation . DB_SYSTEM ,
53
+ [ SemanticAttributes . DB_STATEMENT ] : 'connect' ,
57
54
} ,
58
55
} ) ;
59
56
const { host, port } = this . options ;
60
57
61
58
span . setAttributes ( {
62
- [ GeneralAttribute . NET_PEER_NAME ] : host ,
63
- [ GeneralAttribute . NET_PEER_PORT ] : port ,
64
- [ GeneralAttribute . NET_PEER_ADDRESS ] : `redis://${ host } :${ port } ` ,
59
+ [ SemanticAttributes . NET_PEER_NAME ] : host ,
60
+ [ SemanticAttributes . NET_PEER_PORT ] : port ,
61
+ [ SemanticAttributes . NET_PEER_IP ] : `redis://${ host } :${ port } ` ,
65
62
} ) ;
66
63
try {
67
64
const client = original . apply ( this , arguments ) ;
@@ -102,8 +99,8 @@ export const traceSendCommand = (
102
99
const span = tracer . startSpan ( cmd . name , {
103
100
kind : SpanKind . CLIENT ,
104
101
attributes : {
105
- [ DatabaseAttribute . DB_SYSTEM ] : IORedisInstrumentation . DB_SYSTEM ,
106
- [ DatabaseAttribute . DB_STATEMENT ] : dbStatementSerializer (
102
+ [ SemanticAttributes . DB_SYSTEM ] : IORedisInstrumentation . DB_SYSTEM ,
103
+ [ SemanticAttributes . DB_STATEMENT ] : dbStatementSerializer (
107
104
cmd . name ,
108
105
cmd . args
109
106
) ,
@@ -113,9 +110,9 @@ export const traceSendCommand = (
113
110
const { host, port } = this . options ;
114
111
115
112
span . setAttributes ( {
116
- [ GeneralAttribute . NET_PEER_NAME ] : host ,
117
- [ GeneralAttribute . NET_PEER_PORT ] : port ,
118
- [ GeneralAttribute . NET_PEER_ADDRESS ] : `redis://${ host } :${ port } ` ,
113
+ [ SemanticAttributes . NET_PEER_NAME ] : host ,
114
+ [ SemanticAttributes . NET_PEER_PORT ] : port ,
115
+ [ SemanticAttributes . NET_PEER_IP ] : `redis://${ host } :${ port } ` ,
119
116
} ) ;
120
117
121
118
try {
0 commit comments