15
15
*/
16
16
17
17
import { context , trace , Span } from '@opentelemetry/api' ;
18
- import { SEMATTRS_HTTP_METHOD } from '@opentelemetry/semantic-conventions' ;
19
18
import { RPCMetadata , RPCType , setRPCMetadata } from '@opentelemetry/core' ;
20
19
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node' ;
21
20
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks' ;
@@ -495,7 +494,7 @@ describe('Restify Instrumentation', () => {
495
494
describe ( 'using requestHook in config' , ( ) => {
496
495
it ( 'calls requestHook provided function when set in config' , async ( ) => {
497
496
const requestHook = ( span : Span , info : RestifyRequestInfo ) => {
498
- span . setAttribute ( SEMATTRS_HTTP_METHOD , info . request . method ) ;
497
+ span . setAttribute ( 'my.http.method' , info . request . method ) ;
499
498
span . setAttribute ( 'restify.layer' , info . layerType ) ;
500
499
} ;
501
500
@@ -517,7 +516,7 @@ describe('Restify Instrumentation', () => {
517
516
// span from get
518
517
const span = memoryExporter . getFinishedSpans ( ) [ 2 ] ;
519
518
assert . notStrictEqual ( span , undefined ) ;
520
- assert . strictEqual ( span . attributes [ SEMATTRS_HTTP_METHOD ] , 'GET' ) ;
519
+ assert . strictEqual ( span . attributes [ 'my.http.method' ] , 'GET' ) ;
521
520
assert . strictEqual (
522
521
span . attributes [ 'restify.layer' ] ,
523
522
'request_handler'
@@ -529,7 +528,7 @@ describe('Restify Instrumentation', () => {
529
528
530
529
it ( 'does not propagate an error from a requestHook that throws exception' , async ( ) => {
531
530
const requestHook = ( span : Span , info : RestifyRequestInfo ) => {
532
- span . setAttribute ( SEMATTRS_HTTP_METHOD , info . request . method ) ;
531
+ span . setAttribute ( 'my.http.method' , info . request . method ) ;
533
532
534
533
throw Error ( 'error thrown in requestHook' ) ;
535
534
} ;
@@ -552,7 +551,7 @@ describe('Restify Instrumentation', () => {
552
551
// span from get
553
552
const span = memoryExporter . getFinishedSpans ( ) [ 2 ] ;
554
553
assert . notStrictEqual ( span , undefined ) ;
555
- assert . strictEqual ( span . attributes [ SEMATTRS_HTTP_METHOD ] , 'GET' ) ;
554
+ assert . strictEqual ( span . attributes [ 'my.http.method' ] , 'GET' ) ;
556
555
}
557
556
}
558
557
) ;
0 commit comments