@@ -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 =>
@@ -96,7 +96,7 @@ export class Http2Plugin extends HttpPlugin {
9696 const plugin = this ;
9797 return (
9898 original : RequestFunction ,
99- authority : string
99+ authority : string | url . URL
100100 ) : Func < http2 . ClientHttp2Stream > => {
101101 return function patchedRequest (
102102 this : http2 . Http2Session ,
@@ -148,7 +148,7 @@ export class Http2Plugin extends HttpPlugin {
148148 private getMakeHttp2RequestTraceFunction (
149149 request : http2 . ClientHttp2Stream ,
150150 headers : http2 . OutgoingHttpHeaders ,
151- authority : string ,
151+ authority : string | url . URL ,
152152 plugin : Http2Plugin
153153 ) : Func < http2 . ClientHttp2Stream > {
154154 return ( span : Span ) : http2 . ClientHttp2Stream => {
@@ -178,7 +178,10 @@ export class Http2Plugin extends HttpPlugin {
178178 const userAgent =
179179 headers [ 'user-agent' ] || headers [ 'User-Agent' ] || null ;
180180
181- const host = url . parse ( authority ) . host ;
181+ const host = ( authority instanceof url . URL
182+ ? authority
183+ : url . parse ( authority )
184+ ) . host ;
182185 if ( host ) {
183186 span . addAttribute ( Http2Plugin . ATTRIBUTE_HTTP_HOST , host ) ;
184187 }
0 commit comments