File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
modules/http-client/src/main/scala/pillars/httpclient Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ object HttpClient extends ModuleSupport:
100100 for
101101 _ <- Resource .eval(logger.info(" Loading HTTP client module" ))
102102 conf <- Resource .eval(reader.read[HttpClient .Config ](" http-client" ))
103- metrics <- ClientMetrics (observability).toResource
103+ metrics <- if conf.metrics then ClientMetrics (observability).map(_.middleware).toResource
104+ else Resource .pure(identity[Client [IO ]])
104105 client <- NettyClientBuilder [IO ]
105106 .withHttp2
106107 .withNioTransport
@@ -119,7 +120,7 @@ object HttpClient extends ModuleSupport:
119120 val followRedirect =
120121 if conf.followRedirect then FollowRedirect [IO ](10 ) else identity[Client [IO ]]
121122 client
122- |> metrics.middleware
123+ |> metrics
123124 |> logging
124125 |> followRedirect
125126 |> HttpClient (conf)
@@ -132,7 +133,8 @@ object HttpClient extends ModuleSupport:
132133 maxConnections : Int = 10 ,
133134 followRedirect : Boolean = true ,
134135 userAgent : `User-Agent` = Config .defaultUserAgent,
135- logging : Logging .HttpConfig = Logging .HttpConfig ()
136+ logging : Logging .HttpConfig = Logging .HttpConfig (),
137+ metrics : Boolean = true
136138 ) extends pillars.Config
137139
138140 object Config :
You can’t perform that action at this time.
0 commit comments