Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update http4s-prometheus-metrics to 0.24.3 #1425

Closed
Show file tree
Hide file tree
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 @@ -9,7 +9,6 @@ import com.ing.baker.runtime.serialization.ProtoMap
import javax.net.ssl.{KeyManagerFactory, SSLContext, TrustManagerFactory}
import org.http4s.EntityDecoder.collectBinary
import org.http4s._
import org.http4s.util.CaseInsensitiveString

import scala.util.{Failure, Success, Try}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.ing.bakery.metrics.MetricService
import io.prometheus.client.Counter
import org.http4s.circe._
import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.dsl.io._
import org.http4s._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import io.prometheus.client.{Collector, CollectorRegistry, Counter}
import io.prometheus.jmx.JmxCollector
import org.http4s.dsl.io._
import org.http4s.implicits.http4sKleisliResponseSyntaxOptionT
import org.http4s.server.blaze.BlazeServerBuilder
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.server.{Router, Server}
import org.http4s._

import java.io.CharArrayWriter
import java.net.InetSocketAddress
import scala.concurrent.ExecutionContext
import scala.io.Source
import org.typelevel.ci._

class MetricService(val registry: CollectorRegistry) extends LazyLogging {
try {
Expand Down Expand Up @@ -68,7 +69,7 @@ object MetricService extends LazyLogging {
Response(
status = Ok,
body = encoder.toEntity(exportMetrics).body,
headers = Headers.of(Header("Content-Type", TextFormat.CONTENT_TYPE_004))
headers = Headers(Header("Content-Type", TextFormat.CONTENT_TYPE_004))Header.Rawci"Content-Type"
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.net.InetSocketAddress
import cats.effect.{ContextShift, IO, Resource, Timer}
import org.http4s.dsl.io.{->, /, GET, Ok, Root, _}
import org.http4s.implicits._
import org.http4s.server.blaze._
import org.http4s.blaze.server._
import org.http4s.server.{Router, Server}
import org.http4s.{HttpApp, HttpRoutes}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.http4s.circe._
import org.http4s.dsl.io._
import org.http4s.implicits._
import org.http4s.metrics.prometheus.Prometheus
import org.http4s.server.blaze._
import org.http4s.blaze.server._
import org.http4s.server.middleware.{Logger, Metrics}
import org.http4s.server.{Router, Server}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.ing.bakery.testing.BakeryFunSpec
import org.http4s.Method._
import org.http4s.Uri
import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.client.dsl.io._
import org.scalatest.ConfigMap
import org.scalatest.matchers.should.Matchers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.ing.bakery.metrics.MetricService
import com.typesafe.config.Config
import com.typesafe.scalalogging.LazyLogging
import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.{Headers, Uri}
import scalax.collection.ChainingOps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.ing.bakery.metrics.MetricService
import com.typesafe.config.ConfigFactory
import io.prometheus.client.CollectorRegistry
import org.http4s.Status.Ok
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.ing.baker.runtime.akka.AkkaBaker
import com.ing.baker.runtime.akka.internal.CachingInteractionManager
import com.ing.baker.runtime.scaladsl._
import com.typesafe.config.ConfigFactory
import org.http4s.server.blaze.BlazeServerBuilder
import org.http4s.blaze.server.BlazeServerBuilder
import org.log4s.Logger
import webshop.webservice.recipe.{MakePaymentInstance, ReserveItemsInstance, ShipItemsInstance}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.ing.baker.compiler.RecipeCompiler
import com.ing.baker.http.client.scaladsl.BakerClient
import com.typesafe.config.ConfigFactory
import org.http4s.Uri
import org.http4s.server.blaze.BlazeServerBuilder
import org.http4s.blaze.server.BlazeServerBuilder

import scala.concurrent.{ExecutionContext, ExecutionContextExecutor}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cats.effect.{ContextShift, IO, Resource, Timer}
import org.http4s.Method._
import org.http4s.Uri
import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.client.dsl.io._

import scala.concurrent.ExecutionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cats.effect.{ContextShift, IO, Timer}
import com.ing.baker.http.client.common.TLSConfig
import com.ing.baker.http.client.scaladsl.{BakerClient => ScalaClient, EndpointConfig}
import com.ing.baker.runtime.javadsl.{Baker => JavaBaker}
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.{Request, Uri}

import java.util.concurrent.CompletableFuture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.http4s.Method._
import org.http4s._
import org.http4s.circe._
import org.http4s.client.Client
import org.http4s.client.blaze._
import org.http4s.blaze.client._
import org.http4s.client.dsl.io._

import scala.collection.immutable.Seq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ import org.http4s.circe._
import org.http4s.dsl.io._
import org.http4s.implicits._
import org.http4s.server.Router
import org.http4s.server.blaze._
import org.http4s.blaze.server._
import org.scalatest.ConfigMap

import java.net.InetSocketAddress
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.compat.java8.FutureConverters
import scala.concurrent.ExecutionContext
import org.typelevel.ci._

@nowarn
class BakerClientSpec extends BakeryFunSpec {

case class Context(serverAddress: InetSocketAddress, receivedHeaders: IO[List[Header]])
case class Context(serverAddress: InetSocketAddress, receivedHeaders: IO[List[Header.Raw]])

val serviceTLSConfig: TLSConfig =
TLSConfig(
Expand Down Expand Up @@ -52,7 +53,7 @@ class BakerClientSpec extends BakeryFunSpec {
*/
def contextBuilder(testArguments: TestArguments): Resource[IO, TestContext] = {

def testServer(receivedHeaders: MVar2[IO, List[Header]]): HttpApp[IO] = {
def testServer(receivedHeaders: MVar2[IO, List[Header.Raw]]): HttpApp[IO] = {
implicit val bakerResultEntityEncoder: EntityEncoder[IO, BakerResult] = jsonEncoderOf[IO, BakerResult]
Router("/api/bakery/instances" -> HttpRoutes.of[IO] {
case request@GET -> Root =>
Expand All @@ -67,7 +68,7 @@ class BakerClientSpec extends BakeryFunSpec {
val sslParams = sslConfig.getDefaultSSLParameters
sslParams.setNeedClientAuth(true)
for {
receivedHeaders <- Resource.eval(MVar.empty[IO, List[Header]])
receivedHeaders <- Resource.eval(MVar.empty[IO, List[Header.Raw]])
service <- BlazeServerBuilder[IO](ExecutionContext.global)
.withSslContextAndParameters(sslConfig, sslParams)
.bindSocketAddress(InetSocketAddress.createUnresolved("localhost", 0))
Expand All @@ -87,7 +88,7 @@ class BakerClientSpec extends BakeryFunSpec {

test("scaladsl - connects with mutual tls and adds headers to requests") { context =>
val host = Uri.unsafeFromString(s"https://localhost:${context.serverAddress.getPort}/")
val testHeader = Header("X-Test", "Foo")
val testHeader = Header.Raw(ci"X-Test", "Foo")
val filter: Request[IO] => Request[IO] = _.putHeaders(testHeader)
ScalaClient.resource(host, "/api/bakery", executionContext, List(filter), Some(clientTLSConfig)).use { client =>
for {
Expand Down Expand Up @@ -116,7 +117,7 @@ class BakerClientSpec extends BakeryFunSpec {

test("javadsl - connects with mutual tls and adds headers to requests") { context =>
val host = s"https://localhost:${context.serverAddress.getPort}/"
val testHeader = Header("X-Test", "Foo")
val testHeader = Header.Raw(ci"X-Test", "Foo")
val filter: java.util.function.Function[Request[IO], Request[IO]] = _.putHeaders(testHeader)
for {
client <- IO.fromFuture(IO(FutureConverters.toScala(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import org.scalatest.funspec.AnyFunSpec

import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
import org.http4s.syntax.literals._


class FailoverStateSpec extends AnyFunSpec {

private val uriA = Uri(path = "baker-a-host")
private val uriB = Uri(path = "baker-b-host")
private val uriC = Uri(path = "baker-c-host")
private val uriD = Uri(path = "baker-d-host")
private val uriA = Uri(path = path"baker-a-host")
private val uriB = Uri(path = path"baker-b-host")
private val uriC = Uri(path = path"baker-c-host")
private val uriD = Uri(path = path"baker-d-host")

describe("Balancer") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import org.http4s.Method.GET
import org.http4s._
import org.http4s.circe.jsonEncoderOf
import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.client.dsl.io._
import org.http4s.dsl.io._
import org.http4s.implicits._
import org.http4s.server.Router
import org.http4s.server.blaze.BlazeServerBuilder
import org.http4s.blaze.server.BlazeServerBuilder
import org.scalatest.funspec.FixtureAsyncFunSpec
import org.scalatest.{Assertion, FutureOutcome}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.http4s.headers.{`Content-Length`, `Content-Type`}
import org.http4s.implicits._
import org.http4s.metrics.MetricsOps
import org.http4s.metrics.prometheus.Prometheus
import org.http4s.server.blaze.BlazeServerBuilder
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.server.middleware.{CORS, Logger, Metrics}
import org.http4s.server.{Router, Server}
import org.slf4j.LoggerFactory
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object Dependencies {
val akkaManagementVersion = "1.1.3"
val akkaPersistenceCassandraVersion = "1.0.5"
val akkaHttpVersion = "10.2.9"
val http4sVersion = "0.21.34"
val http4sVersion = "0.24.3"
val fs2Version = "2.5.10"
val circeVersion = "0.14.2"
val mockitoScalaVersion = "1.17.7"
Expand Down