diff --git a/Makefile b/Makefile index 4755b286..70f0d01a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=1.8.3 +VERSION=1.8.4 default: compile @@ -24,13 +24,13 @@ config: distro: clean compile jars -docker-build: +build-docker: docker build -f ./etc/docker/proxy.df -t pambrose/prometheus-proxy:${VERSION} . docker build -f ./etc/docker/proxy.df -t pambrose/prometheus-proxy:latest . docker build -f ./etc/docker/agent.df -t pambrose/prometheus-agent:${VERSION} . docker build -f ./etc/docker/agent.df -t pambrose/prometheus-agent:latest . -docker-push: +push-docker: docker push pambrose/prometheus-proxy:${VERSION} docker push pambrose/prometheus-proxy:latest docker push pambrose/prometheus-agent:${VERSION} diff --git a/README.md b/README.md index a1e5633e..d531850e 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,8 @@ scrape_configs: The docker images are available via: ```bash -docker pull pambrose/prometheus-proxy:1.8.3 -docker pull pambrose/prometheus-agent:1.8.3 +docker pull pambrose/prometheus-proxy:1.8.4 +docker pull pambrose/prometheus-agent:1.8.4 ``` Start a proxy container with: @@ -107,7 +107,7 @@ Start a proxy container with: docker run --rm -p 8082:8082 -p 8092:8092 -p 50051:50051 -p 8080:8080 \ --env ADMIN_ENABLED=true \ --env METRICS_ENABLED=true \ - pambrose/prometheus-proxy:1.8.3 + pambrose/prometheus-proxy:1.8.4 ``` Start an agent container with: @@ -115,7 +115,7 @@ Start an agent container with: ```bash docker run --rm -p 8083:8083 -p 8093:8093 \ --env AGENT_CONFIG='https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf' \ - pambrose/prometheus-agent:1.8.3 + pambrose/prometheus-agent:1.8.4 ``` Using the config file [simple.conf](https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf), @@ -131,7 +131,7 @@ is in your current directory, run an agent container with: docker run --rm -p 8083:8083 -p 8093:8093 \ --mount type=bind,source="$(pwd)"/prom-agent.conf,target=/app/prom-agent.conf \ --env AGENT_CONFIG=prom-agent.conf \ - pambrose/prometheus-agent:1.8.3 + pambrose/prometheus-agent:1.8.4 ``` **Note:** The `WORKDIR` of the proxy and agent images is `/app`, so make sure @@ -252,7 +252,7 @@ docker run --rm -p 8082:8082 -p 8092:8092 -p 50440:50440 -p 8080:8080 \ --env PROXY_CONFIG=tls-no-mutual-auth.conf \ --env ADMIN_ENABLED=true \ --env METRICS_ENABLED=true \ - pambrose/prometheus-proxy:1.8.3 + pambrose/prometheus-proxy:1.8.4 docker run --rm -p 8083:8083 -p 8093:8093 \ --mount type=bind,source="$(pwd)"/testing/certs,target=/app/testing/certs \ @@ -260,7 +260,7 @@ docker run --rm -p 8083:8083 -p 8093:8093 \ --env AGENT_CONFIG=tls-no-mutual-auth.conf \ --env PROXY_HOSTNAME=mymachine.lan:50440 \ --name docker-agent \ - pambrose/prometheus-agent:1.8.3 + pambrose/prometheus-agent:1.8.4 ``` **Note:** The `WORKDIR` of the proxy and agent images is `/app`, so make sure diff --git a/bin/docker-agent.sh b/bin/docker-agent.sh index 58d46151..829680e9 100755 --- a/bin/docker-agent.sh +++ b/bin/docker-agent.sh @@ -3,4 +3,4 @@ docker run --rm -p 8083:8083 -p 8093:8093 \ --env AGENT_CONFIG='https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf' \ --env PROXY_HOSTNAME=mymachine.lan \ - pambrose/prometheus-agent:1.8.3 + pambrose/prometheus-agent:1.8.4 diff --git a/bin/docker-proxy.sh b/bin/docker-proxy.sh index 15f93149..62b6bb53 100755 --- a/bin/docker-proxy.sh +++ b/bin/docker-proxy.sh @@ -2,4 +2,4 @@ docker run --rm -p 8082:8082 -p 8092:8092 -p 50051:50051 -p 8080:8080 \ --env PROXY_CONFIG='https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf' \ - pambrose/prometheus-proxy:1.8.3 + pambrose/prometheus-proxy:1.8.4 diff --git a/build.gradle b/build.gradle index b7c93e23..8d9a9050 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ plugins { } group = 'io.prometheus' -version = '1.8.3' +version = '1.8.4' sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/docs/release.md b/docs/release.md index 08b90fb8..e5ec92fe 100644 --- a/docs/release.md +++ b/docs/release.md @@ -21,7 +21,7 @@ 10) Create release on github (https://github.com/pambrose/prometheus-proxy/releases) and upload the *build/libs/prometheus-proxy.jar* and *build/libs/prometheus-agent.jar* files. -11) Build and push docker images with: `make docker-build docker-push` +11) Build and push docker images with: `make build-docker push-docker` 12) Update the *prometheus-proxy* and *prometheus-agent* repository descriptions on [Docker hub](https://hub.docker.com) with the latest version of *README.md*. \ No newline at end of file diff --git a/etc/compose/proxy.yml b/etc/compose/proxy.yml index 3e5341b1..8db75137 100644 --- a/etc/compose/proxy.yml +++ b/etc/compose/proxy.yml @@ -1,6 +1,6 @@ prometheus-proxy: autoredeploy: true - image: 'pambrose/prometheus-proxy:1.8.3' + image: 'pambrose/prometheus-proxy:1.8.4' ports: - '8080:8080' - '8082:8082' diff --git a/gradle.properties b/gradle.properties index c00f0859..4412fb72 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,5 +21,5 @@ prometheus_version=0.9.0 protoc_version=3.12.4 slf4j_version=1.7.30 typesafe_version=1.4.0 -utils_version=35fcd6c +utils_version=8a9b883 zipkin_version=5.12.5 \ No newline at end of file diff --git a/src/main/kotlin/io/prometheus/Agent.kt b/src/main/kotlin/io/prometheus/Agent.kt index 72c5bf10..ecf077cb 100644 --- a/src/main/kotlin/io/prometheus/Agent.kt +++ b/src/main/kotlin/io/prometheus/Agent.kt @@ -50,7 +50,7 @@ import kotlin.time.TimeSource.Monotonic import kotlin.time.milliseconds import kotlin.time.seconds -@Version(version = "1.8.3", date = "9/1/20") +@Version(version = "1.8.4", date = "9/3/20") class Agent(val options: AgentOptions, inProcessServerName: String = "", testMode: Boolean = false, diff --git a/src/main/kotlin/io/prometheus/Proxy.kt b/src/main/kotlin/io/prometheus/Proxy.kt index 96255801..fb349146 100644 --- a/src/main/kotlin/io/prometheus/Proxy.kt +++ b/src/main/kotlin/io/prometheus/Proxy.kt @@ -45,7 +45,7 @@ import java.time.LocalDateTime import java.time.format.DateTimeFormatter import kotlin.time.milliseconds -@Version(version = "1.8.3", date = "9/1/20") +@Version(version = "1.8.4", date = "9/3/20") class Proxy(val options: ProxyOptions, proxyHttpPort: Int = options.proxyHttpPort, inProcessServerName: String = "", diff --git a/src/main/kotlin/io/prometheus/agent/AgentHttpService.kt b/src/main/kotlin/io/prometheus/agent/AgentHttpService.kt index 3852e40a..0ef91c45 100644 --- a/src/main/kotlin/io/prometheus/agent/AgentHttpService.kt +++ b/src/main/kotlin/io/prometheus/agent/AgentHttpService.kt @@ -19,12 +19,12 @@ package io.prometheus.agent import com.github.pambrose.common.dsl.KtorDsl.get -import com.github.pambrose.common.dsl.KtorDsl.newHttpClient -import com.github.pambrose.common.dsl.KtorDsl.withHttpClient import com.github.pambrose.common.util.isNull import com.github.pambrose.common.util.simpleClassName import com.github.pambrose.common.util.zip import com.google.common.net.HttpHeaders +import io.ktor.client.* +import io.ktor.client.engine.cio.* import io.ktor.client.features.* import io.ktor.client.request.* import io.ktor.client.statement.* @@ -71,22 +71,22 @@ internal class AgentHttpService(val agent: Agent) { // Content is fetched here try { - newHttpClient { - requestTimeout = 90.seconds.toLongMilliseconds() - }.use { client -> - withHttpClient(client) { - get(url, - { - val accept: String? = request.accept - if (accept?.isNotEmpty() == true) - header(HttpHeaders.ACCEPT, accept) - val scrapeTimeout = agent.options.scrapeTimeoutSecs.seconds - logger.debug { "Setting scrapeTimeoutSecs = $scrapeTimeout" } - timeout { requestTimeoutMillis = scrapeTimeout.toLongMilliseconds() } - }, - getBlock(url, scrapeResults, scrapeMsg, request.debugEnabled)) + CIO.create { requestTimeout = 90.seconds.toLongMilliseconds() } + .use { engine -> + HttpClient(engine) { install(HttpTimeout) } + .use { client -> + client.get(url, + { + val accept: String? = request.accept + if (accept?.isNotEmpty() == true) + header(HttpHeaders.ACCEPT, accept) + val scrapeTimeout = agent.options.scrapeTimeoutSecs.seconds + logger.debug { "Setting scrapeTimeoutSecs = $scrapeTimeout" } + timeout { requestTimeoutMillis = scrapeTimeout.toLongMilliseconds() } + }, + getBlock(url, scrapeResults, scrapeMsg, request.debugEnabled)) + } } - } } catch (e: TimeoutCancellationException) { logger.warn(e) { "fetchScrapeUrl() $e - $url" } diff --git a/wercker.yml b/wercker.yml index 44e0d930..681a063e 100644 --- a/wercker.yml +++ b/wercker.yml @@ -1,4 +1,5 @@ -box: java +box: + id: openjdk dev: steps: