@@ -10,7 +10,7 @@ import {
1010} from '@opentelemetry/instrumentation' ;
1111import { VERSION } from './version' ;
1212import { AttributeNames } from './enums' ;
13- import { SemanticAttributes } from '@opentelemetry/semantic-conventions' ;
13+ import { SEMATTRS_DB_OPERATION , SEMATTRS_DB_STATEMENT , SemanticAttributes } from '@opentelemetry/semantic-conventions' ;
1414import {
1515 startSpan ,
1616 onError ,
@@ -21,7 +21,7 @@ import {
2121} from './utils' ;
2222import { ELASTICSEARCH_API_FILES } from './helpers' ;
2323
24- export class ElasticsearchInstrumentation extends InstrumentationBase < typeof elasticsearch > {
24+ export class ElasticsearchInstrumentation extends InstrumentationBase {
2525 static readonly component = '@elastic/elasticsearch' ;
2626
2727 protected override _config : ElasticsearchInstrumentationConfig ;
@@ -36,18 +36,18 @@ export class ElasticsearchInstrumentation extends InstrumentationBase<typeof ela
3636 this . _config = Object . assign ( { } , config ) ;
3737 }
3838
39- protected init ( ) : InstrumentationModuleDefinition < typeof elasticsearch > {
39+ protected init ( ) : InstrumentationModuleDefinition {
4040 const apiModuleFiles = ELASTICSEARCH_API_FILES . map (
4141 ( { path, operationClassName } ) =>
42- new InstrumentationNodeModuleFile < any > (
42+ new InstrumentationNodeModuleFile (
4343 `@elastic/elasticsearch/api/${ path } ` ,
4444 [ '>=5 <8' ] ,
4545 this . patch . bind ( this , operationClassName ) ,
4646 this . unpatch . bind ( this )
4747 )
4848 ) ;
4949
50- const module = new InstrumentationNodeModuleDefinition < typeof elasticsearch > (
50+ const module = new InstrumentationNodeModuleDefinition (
5151 ElasticsearchInstrumentation . component ,
5252 [ '*' ] ,
5353 undefined ,
@@ -120,11 +120,13 @@ export class ElasticsearchInstrumentation extends InstrumentationBase<typeof ela
120120 const span = startSpan ( {
121121 tracer : self . tracer ,
122122 attributes : {
123- [ SemanticAttributes . DB_OPERATION ] : operation ,
123+ [ SEMATTRS_DB_OPERATION ] : operation ,
124124 [ 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+ ) ,
128130 } ,
129131 } ) ;
130132 self . _addModuleVersionIfNeeded ( span ) ;
0 commit comments