@@ -78,7 +78,7 @@ export class Http2Plugin extends HttpPlugin {
7878 return ( original : ConnectFunction ) : Func < http2 . ClientHttp2Session > => {
7979 return function patchedConnect (
8080 this : Http2Plugin ,
81- authority : string
81+ authority : string | url . URL
8282 ) : http2 . ClientHttp2Session {
8383 const client = original . apply ( this , arguments ) ;
8484 shimmer . wrap ( client , 'request' , original =>
@@ -94,7 +94,7 @@ export class Http2Plugin extends HttpPlugin {
9494 const plugin = this ;
9595 return (
9696 original : RequestFunction ,
97- authority : string
97+ authority : string | url . URL
9898 ) : Func < http2 . ClientHttp2Stream > => {
9999 return function patchedRequest (
100100 this : http2 . Http2Session ,
@@ -146,7 +146,7 @@ export class Http2Plugin extends HttpPlugin {
146146 private getMakeHttp2RequestTraceFunction (
147147 request : http2 . ClientHttp2Stream ,
148148 headers : http2 . OutgoingHttpHeaders ,
149- authority : string ,
149+ authority : string | url . URL ,
150150 plugin : Http2Plugin
151151 ) : Func < http2 . ClientHttp2Stream > {
152152 return ( span : Span ) : http2 . ClientHttp2Stream => {
@@ -176,7 +176,10 @@ export class Http2Plugin extends HttpPlugin {
176176 const userAgent =
177177 headers [ 'user-agent' ] || headers [ 'User-Agent' ] || null ;
178178
179- const host = url . parse ( authority ) . host ;
179+ const host = ( authority instanceof url . URL
180+ ? authority
181+ : url . parse ( authority )
182+ ) . host ;
180183 if ( host ) {
181184 span . addAttribute ( Http2Plugin . ATTRIBUTE_HTTP_HOST , host ) ;
182185 }
0 commit comments