Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ object HttpClient extends ModuleSupport:
for
_ <- Resource.eval(logger.info("Loading HTTP client module"))
conf <- Resource.eval(reader.read[HttpClient.Config]("http-client"))
metrics <- ClientMetrics(observability).toResource
metrics <- if conf.metrics then ClientMetrics(observability).map(_.middleware).toResource
else Resource.pure(identity[Client[IO]])
client <- NettyClientBuilder[IO]
.withHttp2
.withNioTransport
Expand All @@ -119,7 +120,7 @@ object HttpClient extends ModuleSupport:
val followRedirect =
if conf.followRedirect then FollowRedirect[IO](10) else identity[Client[IO]]
client
|> metrics.middleware
|> metrics
|> logging
|> followRedirect
|> HttpClient(conf)
Expand All @@ -132,7 +133,8 @@ object HttpClient extends ModuleSupport:
maxConnections: Int = 10,
followRedirect: Boolean = true,
userAgent: `User-Agent` = Config.defaultUserAgent,
logging: Logging.HttpConfig = Logging.HttpConfig()
logging: Logging.HttpConfig = Logging.HttpConfig(),
metrics: Boolean = true
) extends pillars.Config

object Config:
Expand Down