1515 */
1616
1717import { context , trace , Span } from '@opentelemetry/api' ;
18- import { SEMATTRS_HTTP_METHOD } from '@opentelemetry/semantic-conventions' ;
1918import { RPCMetadata , RPCType , setRPCMetadata } from '@opentelemetry/core' ;
2019import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node' ;
2120import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks' ;
@@ -495,7 +494,7 @@ describe('Restify Instrumentation', () => {
495494 describe ( 'using requestHook in config' , ( ) => {
496495 it ( 'calls requestHook provided function when set in config' , async ( ) => {
497496 const requestHook = ( span : Span , info : RestifyRequestInfo ) => {
498- span . setAttribute ( SEMATTRS_HTTP_METHOD , info . request . method ) ;
497+ span . setAttribute ( 'my.http.method' , info . request . method ) ;
499498 span . setAttribute ( 'restify.layer' , info . layerType ) ;
500499 } ;
501500
@@ -517,7 +516,7 @@ describe('Restify Instrumentation', () => {
517516 // span from get
518517 const span = memoryExporter . getFinishedSpans ( ) [ 2 ] ;
519518 assert . notStrictEqual ( span , undefined ) ;
520- assert . strictEqual ( span . attributes [ SEMATTRS_HTTP_METHOD ] , 'GET' ) ;
519+ assert . strictEqual ( span . attributes [ 'my.http.method' ] , 'GET' ) ;
521520 assert . strictEqual (
522521 span . attributes [ 'restify.layer' ] ,
523522 'request_handler'
@@ -529,7 +528,7 @@ describe('Restify Instrumentation', () => {
529528
530529 it ( 'does not propagate an error from a requestHook that throws exception' , async ( ) => {
531530 const requestHook = ( span : Span , info : RestifyRequestInfo ) => {
532- span . setAttribute ( SEMATTRS_HTTP_METHOD , info . request . method ) ;
531+ span . setAttribute ( 'my.http.method' , info . request . method ) ;
533532
534533 throw Error ( 'error thrown in requestHook' ) ;
535534 } ;
@@ -552,7 +551,7 @@ describe('Restify Instrumentation', () => {
552551 // span from get
553552 const span = memoryExporter . getFinishedSpans ( ) [ 2 ] ;
554553 assert . notStrictEqual ( span , undefined ) ;
555- assert . strictEqual ( span . attributes [ SEMATTRS_HTTP_METHOD ] , 'GET' ) ;
554+ assert . strictEqual ( span . attributes [ 'my.http.method' ] , 'GET' ) ;
556555 }
557556 }
558557 ) ;
0 commit comments