diff --git a/Makefile b/Makefile
index 15a5fa2b..e468194b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=1.3.1
+VERSION=1.3.2
default: build
@@ -33,8 +33,8 @@ sonar:
distro: build
mkdir target/distro
- mv target/proxy-jar-with-dependencies.jar target/distro/prometheus-proxy.jar
- mv target/agent-jar-with-dependencies.jar target/distro/prometheus-agent.jar
+ mv target/prometheus-proxy-jar-with-dependencies.jar target/distro/prometheus-proxy.jar
+ mv target/prometheus-agent-jar-with-dependencies.jar target/distro/prometheus-agent.jar
site:
./mvnw site
diff --git a/README.md b/README.md
index cc29882b..e77c35c7 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/pambrose/prometheus-proxy.svg?branch=master)](https://travis-ci.org/pambrose/prometheus-proxy)
[![Coverage Status](https://coveralls.io/repos/github/pambrose/prometheus-proxy/badge.svg?branch=master)](https://coveralls.io/github/pambrose/prometheus-proxy?branch=master)
[![Code Climate](https://codeclimate.com/github/pambrose/prometheus-proxy/badges/gpa.svg)](https://codeclimate.com/github/pambrose/prometheus-proxy)
-
+[![Dependency Status](https://www.versioneye.com/user/projects/5a4c7a110fb24f0536e5b92f/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/5a4c7a110fb24f0536e5b92f)
[Prometheus](https://prometheus.io) is an excellent systems monitoring and alerting toolkit, which uses a pull model for
collecting metrics. The pull model is problematic when a Prometheus server and its metrics endpoints are separated
@@ -84,8 +84,8 @@ scrape_configs:
The docker images are available via:
```bash
-$ docker pull pambrose/prometheus-proxy:1.3.1
-$ docker pull pambrose/prometheus-agent:1.3.1
+$ docker pull pambrose/prometheus-proxy:1.3.2
+$ docker pull pambrose/prometheus-agent:1.3.2
```
Start the proxy and an agent in separate shells on your local machine:
@@ -94,14 +94,14 @@ Start the proxy and an agent in separate shells on your local machine:
$ docker run --rm -p 8082:8082 -p 8092:8092 -p 50051:50051 -p 8080:8080 \
-e HOSTNAME=${HOSTNAME} \
-e METRICS_ENABLED=true \
- pambrose/prometheus-proxy:1.3.1
+ pambrose/prometheus-proxy:1.3.2
```
```bash
$ docker run --rm -p 8083:8083 -p 8093:8093 \
-e HOSTNAME=${HOSTNAME} \
-e AGENT_CONFIG='https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf' \
- pambrose/prometheus-agent:1.3.1
+ pambrose/prometheus-agent:1.3.2
```
Using the config file [simple.conf](https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf),
diff --git a/bin/docker-agent.sh b/bin/docker-agent.sh
index aab5d37a..66581c20 100755
--- a/bin/docker-agent.sh
+++ b/bin/docker-agent.sh
@@ -3,4 +3,4 @@
docker run --rm -p 8083:8083 -p 8093:8093 \
-e HOSTNAME=${HOSTNAME} \
-e AGENT_CONFIG='https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf' \
- pambrose/prometheus-agent:1.3.1
\ No newline at end of file
+ pambrose/prometheus-agent:1.3.2
\ No newline at end of file
diff --git a/bin/docker-proxy.sh b/bin/docker-proxy.sh
index 077d8920..47f7295a 100755
--- a/bin/docker-proxy.sh
+++ b/bin/docker-proxy.sh
@@ -3,4 +3,4 @@
docker run --rm -p 8082:8082 -p 8092:8092 -p 50051:50051 -p 8080:8080 \
-e HOSTNAME=${HOSTNAME} \
-e PROXY_CONFIG='https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf' \
- pambrose/prometheus-proxy:1.3.1
\ No newline at end of file
+ pambrose/prometheus-proxy:1.3.2
\ No newline at end of file
diff --git a/docs/release.md b/docs/release.md
index a267c063..732b38b3 100644
--- a/docs/release.md
+++ b/docs/release.md
@@ -12,9 +12,10 @@
6) Check in branch and merge
-7) Create release on github and upload target/distro/prometheus-proxy.jar and target/distro/prometheus-agent.jar
+7) Create release on github (https://github.com/pambrose/prometheus-proxy/releases) and
+upload the *target/distro/prometheus-proxy.jar* and *target/distro/prometheus-agent.jar* files.
8) Build and push docker images: `make docker-build docker-push`
-9) Update the *prometheus-proxy* and *prometheus-agent* repository descriptions on
-the Docker hub with the latest version of *README.md*.
\ No newline at end of file
+9) 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 e0ca2ed0..49d2a749 100644
--- a/etc/compose/proxy.yml
+++ b/etc/compose/proxy.yml
@@ -1,6 +1,6 @@
prometheus-proxy:
autoredeploy: true
- image: 'pambrose/prometheus-proxy:1.3.1'
+ image: 'pambrose/prometheus-proxy:1.3.2'
ports:
- '8080:8080'
- '8082:8082'
diff --git a/pom.xml b/pom.xml
index b96b63aa..32b72344 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
io.prometheus
prometheus-proxy
- 1.3.1-SNAPSHOT
+ 1.3.2-SNAPSHOT
1.2.10
@@ -31,8 +31,9 @@
1.3.2
1.8.0
1.8.0
+ 0.7.0
3.4.0
- 0.5.0
+ 0.5.1
19.0
2.7.1
9.4.6.v20170531
@@ -47,12 +48,12 @@
1.7.25
4.12
- 3.8.0
+ 3.9.0
2.0.0
- 2.6
- 3.6.1
- 3.0.2
+ 2.6
+ 3.7.0
+ 3.0.2
1.10
3.5.0
@@ -185,6 +186,12 @@
${grpc.version}
+
+ com.salesforce.servicelibs
+ grpc-contrib
+ ${grpc.contrib.version}
+
+
com.squareup.okhttp3
okhttp
@@ -387,7 +394,7 @@
maven-jar-plugin
- ${maven-jar-plugin.version}
+ ${maven.jar.plugin.version}
@@ -439,7 +446,7 @@
maven-assembly-plugin
- ${assembly.version}
+ ${maven.assembly.version}
proxy
@@ -449,7 +456,7 @@
package
- proxy
+ prometheus-proxy
jar-with-dependencies
@@ -470,7 +477,7 @@
package
- agent
+ prometheus-agent
jar-with-dependencies
diff --git a/src/main/java/io/prometheus/Agent.kt b/src/main/java/io/prometheus/Agent.kt
index 7f2cf765..e7fc0b5a 100644
--- a/src/main/java/io/prometheus/Agent.kt
+++ b/src/main/java/io/prometheus/Agent.kt
@@ -18,79 +18,98 @@ package io.prometheus
import brave.Tracing
import brave.grpc.GrpcTracing
-import com.google.common.base.MoreObjects
import com.google.common.base.Preconditions.checkNotNull
-import com.google.common.collect.Maps
+import com.google.common.collect.Maps.newConcurrentMap
import com.google.common.net.HttpHeaders.CONTENT_TYPE
import com.google.common.util.concurrent.RateLimiter
-import com.google.common.util.concurrent.ThreadFactoryBuilder
import com.google.protobuf.Empty
import io.grpc.ClientInterceptor
import io.grpc.ClientInterceptors.intercept
import io.grpc.ManagedChannel
import io.grpc.Status
import io.grpc.StatusRuntimeException
-import io.grpc.inprocess.InProcessChannelBuilder
-import io.grpc.netty.NettyChannelBuilder
-import io.grpc.stub.StreamObserver
import io.prometheus.agent.*
import io.prometheus.common.*
+import io.prometheus.common.AdminConfig.Companion.newAdminConfig
+import io.prometheus.common.MetricsConfig.Companion.newMetricsConfig
+import io.prometheus.common.ZipkinConfig.Companion.newZipkinConfig
+import io.prometheus.delegate.AtomicDelegates
+import io.prometheus.delegate.AtomicDelegates.notNullReference
+import io.prometheus.dsl.GrpcDsl.channel
+import io.prometheus.dsl.GrpcDsl.streamObserver
+import io.prometheus.dsl.GuavaDsl.toStringElements
+import io.prometheus.dsl.ThreadDsl.threadFactory
import io.prometheus.grpc.*
import io.prometheus.grpc.ProxyServiceGrpc.*
import okhttp3.OkHttpClient
import org.slf4j.LoggerFactory
import java.io.IOException
-import java.util.concurrent.*
+import java.util.concurrent.ArrayBlockingQueue
+import java.util.concurrent.CountDownLatch
+import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors.newCachedThreadPool
+import java.util.concurrent.Executors.newFixedThreadPool
+import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
+import kotlin.properties.Delegates.notNull
class Agent(options: AgentOptions,
private val inProcessServerName: String = "",
- testMode: Boolean = false) : GenericService(options.configVals,
- AdminConfig.create(options.adminEnabled,
- options.adminPort!!,
- options.configVals.agent.admin),
- MetricsConfig.create(options.metricsEnabled,
- options.metricsPort!!,
- options.configVals.agent.metrics),
- ZipkinConfig.create(options.configVals.agent.internal.zipkin),
- testMode) {
-
- private val pathContextMap = Maps.newConcurrentMap() // Map path to PathContext
- private val heartbeatService = Executors.newFixedThreadPool(1)
+ testMode: Boolean = false,
+ initBlock: (Agent.() -> Unit)? = null) : GenericService(options.configVals,
+ newAdminConfig(options.adminEnabled,
+ options.adminPort,
+ options.configVals.agent.admin),
+ newMetricsConfig(options.metricsEnabled,
+ options.metricsPort,
+ options.configVals.agent.metrics),
+ newZipkinConfig(options.configVals.agent.internal.zipkin),
+ testMode) {
+ private val pathContextMap = newConcurrentMap() // Map path to PathContext
+ private val heartbeatService = newFixedThreadPool(1)
private val initialConnectionLatch = CountDownLatch(1)
private val okHttpClient = OkHttpClient()
private val scrapeResponseQueue = ArrayBlockingQueue(configVals.internal.scrapeResponseQueueSize)
- private val agentName: String = if (options.agentName.isNullOrBlank()) "Unnamed-${io.prometheus.common.hostName}" else options.agentName!!
- private val metrics: AgentMetrics? = if (metricsEnabled) AgentMetrics(this) else null
- private var blockingStub: ProxyServiceBlockingStub by AtomicDelegates.notNullReference()
- private var asyncStub: ProxyServiceStub by AtomicDelegates.notNullReference()
+ private val agentName: String = if (options.agentName.isBlank()) "Unnamed-$localHostName" else options.agentName
+ private var metrics: AgentMetrics by notNull()
+ private var blockingStub: ProxyServiceBlockingStub by notNullReference()
+ private var asyncStub: ProxyServiceStub by notNullReference()
private val readRequestsExecutorService: ExecutorService =
- newCachedThreadPool(if (metricsEnabled)
- InstrumentedThreadFactory.newInstrumentedThreadFactory("agent_fetch",
- "Agent fetch",
- true)
+ newCachedThreadPool(if (isMetricsEnabled)
+ InstrumentedThreadFactory(
+ threadFactory {
+ setNameFormat("agent_fetch" + "-%d")
+ setDaemon(true)
+ }, "agent_fetch", "Agent fetch")
else
- ThreadFactoryBuilder()
- .setNameFormat("agent_fetch-%d")
- .setDaemon(true)
- .build())
+ threadFactory {
+ setNameFormat("agent_fetch-%d")
+ setDaemon(true)
+ })
+
+ private var tracing: Tracing by notNull()
+ private var grpcTracing: GrpcTracing by notNull()
- private val tracing: Tracing?
- private val grpcTracing: GrpcTracing?
private val hostName: String
private val port: Int
- private val reconnectLimiter: RateLimiter
- private val pathConfigs: List