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:
100
100
for
101
101
_ <- Resource .eval(logger.info(" Loading HTTP client module" ))
102
102
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 ]])
104
105
client <- NettyClientBuilder [IO ]
105
106
.withHttp2
106
107
.withNioTransport
@@ -119,7 +120,7 @@ object HttpClient extends ModuleSupport:
119
120
val followRedirect =
120
121
if conf.followRedirect then FollowRedirect [IO ](10 ) else identity[Client [IO ]]
121
122
client
122
- |> metrics.middleware
123
+ |> metrics
123
124
|> logging
124
125
|> followRedirect
125
126
|> HttpClient (conf)
@@ -132,7 +133,8 @@ object HttpClient extends ModuleSupport:
132
133
maxConnections : Int = 10 ,
133
134
followRedirect : Boolean = true ,
134
135
userAgent : `User-Agent` = Config .defaultUserAgent,
135
- logging : Logging .HttpConfig = Logging .HttpConfig ()
136
+ logging : Logging .HttpConfig = Logging .HttpConfig (),
137
+ metrics : Boolean = true
136
138
) extends pillars.Config
137
139
138
140
object Config :
You can’t perform that action at this time.
0 commit comments