Skip to content

Commit

Permalink
1.3.4 (#13)
Browse files Browse the repository at this point in the history
* Update typesafe, grpc, zipkin and assertj jars
* Update kotlin, prometheus, okhttp, and brave jars
  • Loading branch information
pambrose authored Mar 2, 2018
1 parent 17a21bc commit 5d60a6b
Show file tree
Hide file tree
Showing 22 changed files with 108 additions and 108 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.3.3
VERSION=1.3.4

default: build

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ scrape_configs:
The docker images are available via:
```bash
$ docker pull pambrose/prometheus-proxy:1.3.3
$ docker pull pambrose/prometheus-agent:1.3.3
$ docker pull pambrose/prometheus-proxy:1.3.4
$ docker pull pambrose/prometheus-agent:1.3.4
```

Start the proxy and an agent in separate shells on your local machine:
Expand All @@ -96,14 +96,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.3
pambrose/prometheus-proxy:1.3.4
```

```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.3
pambrose/prometheus-agent:1.3.4
```

Using the config file [simple.conf](https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf),
Expand Down
2 changes: 1 addition & 1 deletion bin/docker-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.3
pambrose/prometheus-agent:1.3.4
2 changes: 1 addition & 1 deletion bin/docker-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.3
pambrose/prometheus-proxy:1.3.4
20 changes: 11 additions & 9 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@

3) Modify code

4) Verify tests run cleanly before merge with: `make tests`
4) Update the release date in *package-info.java*

5) Check in branch and merge
5) Verify tests run cleanly before merge with: `make tests`

6) Go back to master
6) Check in branch and merge

7) Verify tests run cleanly after merge with: `make tests`
7) Go back to master

8) Build distro with: `make distro`
8) Verify tests run cleanly after merge with: `make tests`

9) Create release on github (https://github.com/pambrose/prometheus-proxy/releases) and
9) Build distro with: `make distro`

10) 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.

10) Build and push docker images with: `make docker-build docker-push`
11) Build and push docker images with: `make docker-build docker-push`

11) Update the *prometheus-proxy* and *prometheus-agent* repository descriptions
on Docker hub (https://hub.docker.com) with the latest version of *README.md*.
12) Update the *prometheus-proxy* and *prometheus-agent* repository descriptions
on [Docker hub](https://hub.docker.com) with the latest version of *README.md*.
2 changes: 1 addition & 1 deletion etc/compose/proxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
prometheus-proxy:
autoredeploy: true
image: 'pambrose/prometheus-proxy:1.3.3'
image: 'pambrose/prometheus-proxy:1.3.4'
ports:
- '8080:8080'
- '8082:8082'
Expand Down
38 changes: 12 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@

<groupId>io.prometheus</groupId>
<artifactId>prometheus-proxy</artifactId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.4-SNAPSHOT</version>

<properties>
<kotlin.version>1.2.21</kotlin.version>
<kotlin.version>1.2.30</kotlin.version>

<prometheus.version>0.2.0</prometheus.version>
<prometheus.version>0.3.0</prometheus.version>
<jcommander.version>1.72</jcommander.version>
<config.version>1.3.2</config.version>
<config.version>1.3.3</config.version>
<guava.version>19.0</guava.version>
<metrics.version>4.0.2</metrics.version>

<grpc.version>1.9.0</grpc.version>
<grpc.plugin.version>1.9.0</grpc.plugin.version>
<grpc.version>1.10.0</grpc.version>
<grpc.plugin.version>1.10.0</grpc.plugin.version>
<grpc.contrib.version>0.7.1</grpc.contrib.version>
<okhttp.version>3.9.1</okhttp.version>
<okhttp.version>3.10.0</okhttp.version>
<protobuf.version>3.5.1</protobuf.version>
<protobuf.plugin.version>0.5.1</protobuf.plugin.version>

<spark.version>2.7.1</spark.version>
<jetty.version>9.4.6.v20170531</jetty.version>

<brave.version>4.14.1</brave.version>
<zipkin-sender.version>2.3.1</zipkin-sender.version>
<brave.version>4.17.0</brave.version>
<zipkin-sender.version>2.3.3</zipkin-sender.version>

<logback.version>1.2.3</logback.version>
<slf4j.version>1.7.25</slf4j.version>
<kotlin.logging.version>1.5.3</kotlin.logging.version>

<junit.version>4.12</junit.version>
<assertj.version>3.9.0</assertj.version>
<assertj.version>3.9.1</assertj.version>
<assertj.maven.version>2.0.0</assertj.maven.version>

<maven.assembly.version>2.6</maven.assembly.version>
Expand All @@ -63,7 +63,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<kotlin.compiler.incremental>false</kotlin.compiler.incremental>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<sonar.exclusions>**/grpc/*.java</sonar.exclusions>
Expand Down Expand Up @@ -272,19 +272,6 @@

</dependencies>

<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</pluginRepository>
</pluginRepositories>

<build>
<defaultGoal>package</defaultGoal>
Expand All @@ -307,7 +294,6 @@
</resources>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down Expand Up @@ -633,7 +619,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<version>0.8.0</version>
<configuration>
<excludes>
<exclude>**/grpc/*.class</exclude>
Expand Down
33 changes: 16 additions & 17 deletions src/main/java/io/prometheus/Agent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ import kotlin.properties.Delegates.notNull
class Agent(options: AgentOptions,
private val inProcessServerName: String = "",
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) {
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<String, PathContext>() // Map path to PathContext
private val heartbeatService = newFixedThreadPool(1)
private val initialConnectionLatch = CountDownLatch(1)
Expand Down Expand Up @@ -450,12 +451,10 @@ class Agent(options: AgentOptions,

val observer =
streamObserver<ScrapeRequest> {
onNext { request ->
readRequestsExecutorService.submit(readRequestAction(request))
}
onNext { readRequestsExecutorService.submit(readRequestAction(it)) }

onError { t ->
val status = Status.fromThrowable(t)
onError {
val status = Status.fromThrowable(it)
logger.error { "Error in readRequestsFromProxy(): $status" }
disconnected.set(true)
}
Expand All @@ -473,12 +472,12 @@ class Agent(options: AgentOptions,
val observer =
asyncStub.writeResponsesToProxy(
streamObserver<Empty> {
onNext { _ ->
onNext {
// Ignore Empty return value
}

onError { t ->
val s = Status.fromThrowable(t)
onError {
val s = Status.fromThrowable(it)
logger.error { "Error in writeResponsesToProxyUntilDisconnected(): ${s.code} ${s.description}" }
disconnected.set(true)
}
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/io/prometheus/Proxy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ class Proxy(options: ProxyOptions,
proxyPort: Int = options.agentPort,
inProcessServerName: String = "",
testMode: Boolean = false,
initBlock: (Proxy.() -> Unit)? = null) : GenericService(options.configVals,
newAdminConfig(options.adminEnabled,
options.adminPort,
options.configVals.proxy.admin),
newMetricsConfig(options.metricsEnabled,
options.metricsPort,
options.configVals.proxy.metrics),
newZipkinConfig(options.configVals.proxy.internal.zipkin),
testMode) {
initBlock: (Proxy.() -> Unit)? = null) :
GenericService(options.configVals,
newAdminConfig(options.adminEnabled,
options.adminPort,
options.configVals.proxy.admin),
newMetricsConfig(options.metricsEnabled,
options.metricsPort,
options.configVals.proxy.metrics),
newZipkinConfig(options.configVals.proxy.internal.zipkin),
testMode) {
val pathManager = PathManager(isTestMode)
val scrapeRequestManager = ScrapeRequestManager()
val agentContextManager = AgentContextManager()
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/io/prometheus/agent/AgentOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ import io.prometheus.common.EnvVars
import io.prometheus.common.EnvVars.AGENT_CONFIG
import io.prometheus.common.EnvVars.PROXY_HOSTNAME

class AgentOptions(argv: Array<String>, exitOnMissingConfig: Boolean) : BaseOptions(Agent::class.java.name,
argv,
AGENT_CONFIG.name,
exitOnMissingConfig) {

constructor(args: List<String>, exitOnMissingConfig: Boolean) : this(Iterables.toArray<String>(args,
String::class.java),
exitOnMissingConfig)
class AgentOptions(argv: Array<String>, exitOnMissingConfig: Boolean) :
BaseOptions(Agent::class.java.name, argv, AGENT_CONFIG.name, exitOnMissingConfig) {
constructor(args: List<String>, exitOnMissingConfig: Boolean) :
this(Iterables.toArray<String>(args, String::class.java), exitOnMissingConfig)

@Parameter(names = ["-p", "--proxy"], description = "Proxy hostname")
var proxyHostname: String = ""
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/io/prometheus/common/GenericService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ abstract class GenericService protected constructor(protected val genericConfigV
private val adminConfig: AdminConfig,
private val metricsConfig: MetricsConfig,
private val zipkinConfig: ZipkinConfig,
val isTestMode: Boolean) : GenericExecutionThreadService(), Closeable {
val isTestMode: Boolean) :
GenericExecutionThreadService(),
Closeable {
protected val healthCheckRegistry = HealthCheckRegistry()

private val services = mutableListOf<Service>()
Expand Down Expand Up @@ -106,7 +108,7 @@ abstract class GenericService protected constructor(protected val genericConfigV
serviceManagerListener {
healthy { logger.info { "All $clazzName services healthy" } }
stopped { logger.info { "All $clazzName services stopped" } }
failure { service -> logger.info { "$clazzName service failed: $service" } }
failure { logger.info { "$clazzName service failed: $it" } }
})
}
registerHealthChecks()
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/prometheus/common/MetricsService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import org.eclipse.jetty.servlet.ServletHolder

class MetricsService(private val port: Int,
private val path: String,
initBlock: (MetricsService.() -> Unit)? = null) : GenericIdleService() {
initBlock: (MetricsService.() -> Unit)? = null) :
GenericIdleService() {
private val server =
server(port) {
handler =
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/prometheus/common/SamplerGaugeCollector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class SamplerGaugeCollector(private val name: String,
private val help: String,
private val labelNames: List<String> = emptyList(),
private val labelValues: List<String> = emptyList(),
private val data: () -> Double) : Collector() {
private val data: () -> Double) :
Collector() {
init {
register<Collector>()
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/prometheus/common/ZipkinReporterService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import mu.KLogging
import zipkin2.reporter.AsyncReporter
import zipkin2.reporter.okhttp3.OkHttpSender

class ZipkinReporterService(private val url: String, val initBlock: (ZipkinReporterService.() -> Unit)? = null) : GenericIdleService() {
class ZipkinReporterService(private val url: String, val initBlock: (ZipkinReporterService.() -> Unit)? = null) :
GenericIdleService() {
private val sender = OkHttpSender.create(url)
private val reporter = AsyncReporter.create(sender)

Expand Down
13 changes: 9 additions & 4 deletions src/main/java/io/prometheus/delegate/AtomicDelegates.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty

object AtomicDelegates {
fun <T : Any> notNullReference(initValue: T? = null): ReadWriteProperty<Any?, T> = NotNullAtomicReferenceDelegate(initValue)
fun <T : Any?> nullableReference(initValue: T? = null): ReadWriteProperty<Any?, T> = NullableAtomicReferenceDelegate(initValue)
}
fun <T : Any> notNullReference(initValue: T? = null): ReadWriteProperty<Any?, T> =
NotNullAtomicReferenceDelegate(initValue)

fun <T : Any?> nullableReference(initValue: T? = null): ReadWriteProperty<Any?, T> =
NullableAtomicReferenceDelegate(initValue)
}

private class NotNullAtomicReferenceDelegate<T : Any>(initValue: T? = null) : ReadWriteProperty<Any?, T> {
private val atomicVal = AtomicReference<T>(initValue)

override operator fun getValue(thisRef: Any?, property: KProperty<*>) = atomicVal.get() ?: throw IllegalStateException("Property ${property.name} should be initialized before get.")
override operator fun getValue(thisRef: Any?, property: KProperty<*>) =
atomicVal.get()
?: throw IllegalStateException("Property ${property.name} should be initialized before get.")

override operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = atomicVal.set(value)
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/prometheus/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

@VersionAnnotation(version = "1.3.3", date = "1/??/18")
@VersionAnnotation(version = "1.3.4", date = "3/2/18")
package io.prometheus;

import io.prometheus.common.VersionAnnotation;
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import io.prometheus.guava.GenericExecutionThreadService
import io.prometheus.guava.genericServiceListener
import mu.KLogging

class AgentContextCleanupService(private val proxy: Proxy, initBlock: (AgentContextCleanupService.() -> Unit)? = null) : GenericExecutionThreadService() {

class AgentContextCleanupService(private val proxy: Proxy, initBlock: (AgentContextCleanupService.() -> Unit)? = null) :
GenericExecutionThreadService() {
init {
addListener(genericServiceListener(this, logger), MoreExecutors.directExecutor())
initBlock?.invoke(this)
Expand Down
Loading

0 comments on commit 5d60a6b

Please sign in to comment.