@@ -10,7 +10,7 @@ import {
10
10
} from '@opentelemetry/instrumentation' ;
11
11
import { VERSION } from './version' ;
12
12
import { AttributeNames } from './enums' ;
13
- import { SemanticAttributes } from '@opentelemetry/semantic-conventions' ;
13
+ import { SEMATTRS_DB_OPERATION , SEMATTRS_DB_STATEMENT , SemanticAttributes } from '@opentelemetry/semantic-conventions' ;
14
14
import {
15
15
startSpan ,
16
16
onError ,
@@ -21,7 +21,7 @@ import {
21
21
} from './utils' ;
22
22
import { ELASTICSEARCH_API_FILES } from './helpers' ;
23
23
24
- export class ElasticsearchInstrumentation extends InstrumentationBase < typeof elasticsearch > {
24
+ export class ElasticsearchInstrumentation extends InstrumentationBase {
25
25
static readonly component = '@elastic/elasticsearch' ;
26
26
27
27
protected override _config : ElasticsearchInstrumentationConfig ;
@@ -36,18 +36,18 @@ export class ElasticsearchInstrumentation extends InstrumentationBase<typeof ela
36
36
this . _config = Object . assign ( { } , config ) ;
37
37
}
38
38
39
- protected init ( ) : InstrumentationModuleDefinition < typeof elasticsearch > {
39
+ protected init ( ) : InstrumentationModuleDefinition {
40
40
const apiModuleFiles = ELASTICSEARCH_API_FILES . map (
41
41
( { path, operationClassName } ) =>
42
- new InstrumentationNodeModuleFile < any > (
42
+ new InstrumentationNodeModuleFile (
43
43
`@elastic/elasticsearch/api/${ path } ` ,
44
44
[ '>=5 <8' ] ,
45
45
this . patch . bind ( this , operationClassName ) ,
46
46
this . unpatch . bind ( this )
47
47
)
48
48
) ;
49
49
50
- const module = new InstrumentationNodeModuleDefinition < typeof elasticsearch > (
50
+ const module = new InstrumentationNodeModuleDefinition (
51
51
ElasticsearchInstrumentation . component ,
52
52
[ '*' ] ,
53
53
undefined ,
@@ -120,11 +120,13 @@ export class ElasticsearchInstrumentation extends InstrumentationBase<typeof ela
120
120
const span = startSpan ( {
121
121
tracer : self . tracer ,
122
122
attributes : {
123
- [ SemanticAttributes . DB_OPERATION ] : operation ,
123
+ [ SEMATTRS_DB_OPERATION ] : operation ,
124
124
[ AttributeNames . ELASTICSEARCH_INDICES ] : getIndexName ( params ) ,
125
- [ SemanticAttributes . DB_STATEMENT ] : (
126
- self . _config . dbStatementSerializer || defaultDbStatementSerializer
127
- ) ( operation , params , options ) ,
125
+ [ SEMATTRS_DB_STATEMENT ] : ( self . _config . dbStatementSerializer || defaultDbStatementSerializer ) (
126
+ operation ,
127
+ params ,
128
+ options
129
+ ) ,
128
130
} ,
129
131
} ) ;
130
132
self . _addModuleVersionIfNeeded ( span ) ;
0 commit comments