Skip to content

Commit

Permalink
1.7.0
Browse files Browse the repository at this point in the history
* Update jars
* Convert to gRPC with coroutines
  • Loading branch information
pambrose authored Jul 9, 2020
1 parent 29b870d commit 2c9dfbc
Show file tree
Hide file tree
Showing 52 changed files with 1,675 additions and 1,668 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
VERSION=1.6.4
VERSION=1.7.0

default: compile

clean:
./gradlew clean

compile:
stubs:
./gradlew generateProto

compile: stubs
./gradlew build -xtest

build: compile
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ scrape_configs:
The docker images are available via:
```bash
docker pull pambrose/prometheus-proxy:1.6.4
docker pull pambrose/prometheus-agent:1.6.4
docker pull pambrose/prometheus-proxy:1.7.0
docker pull pambrose/prometheus-agent:1.7.0
```

Start a proxy container with:
Expand All @@ -107,15 +107,15 @@ 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.6.4
pambrose/prometheus-proxy:1.7.0
```

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.6.4
pambrose/prometheus-agent:1.7.0
```

Using the config file [simple.conf](https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf),
Expand All @@ -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.6.4
pambrose/prometheus-agent:1.7.0
```

**Note:** The `WORKDIR` of the proxy and agent images is `/app`, so make sure
Expand Down Expand Up @@ -226,11 +226,11 @@ The gRPC docs describe [how to setup TLS](https://github.com/grpc/grpc-java/tree
The [repo](https://github.com/pambrose/prometheus-proxy/tree/master/testing/certs) includes the
certificates and keys necessary to test TLS support.

These settings are required to run TLS without mutual authentication:
Running TLS without mutual authentication requires these settingss:
* certChainFilePath and privateKeyFilePath on the proxy
* trustCertCollectionFilePath on the agent

These settings are required to run TLS with mutual authentication:
Running TLS with mutual authentication requires these settingss:
* certChainFilePath, privateKeyFilePath and trustCertCollectionFilePath on the proxy
* certChainFilePath, privateKeyFilePath and trustCertCollectionFilePath on the agent

Expand All @@ -250,15 +250,15 @@ 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.6.4
pambrose/prometheus-proxy:1.7.0

docker run --rm -p 8083:8083 -p 8093:8093 \
--mount type=bind,source="$(pwd)"/testing/certs,target=/app/testing/certs \
--mount type=bind,source="$(pwd)"/examples/tls-no-mutual-auth.conf,target=/app/tls-no-mutual-auth.conf \
--env AGENT_CONFIG=tls-no-mutual-auth.conf \
--env PROXY_HOSTNAME=mymachine.lan:50440 \
--name docker-agent \
pambrose/prometheus-agent:1.6.4
pambrose/prometheus-agent:1.7.0
```

**Note:** The `WORKDIR` of the proxy and agent images is `/app`, so make sure
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 \
--env AGENT_CONFIG='https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/simple.conf' \
--env PROXY_HOSTNAME=mymachine.lan \
pambrose/prometheus-agent:1.6.4
pambrose/prometheus-agent:1.7.0
2 changes: 1 addition & 1 deletion bin/docker-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.4
pambrose/prometheus-proxy:1.7.0
157 changes: 91 additions & 66 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
plugins {
id 'idea'
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.71'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.71'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.72'
id 'com.google.protobuf' version '0.8.12'
id "com.github.ben-manes.versions" version '0.28.0'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.10.1'
}

group = 'io.prometheus'
version = '1.6.4'
version = '1.7.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -27,66 +27,117 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-reflect"

implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${serialization_version}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutines_version}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${coroutines_version}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:${coroutines_version}"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:$coroutines_version"

implementation "io.grpc:grpc-all:${grpc_version}"
//implementation "io.grpc:grpc-all:$grpc_version"
implementation "io.grpc:grpc-netty-shaded:${grpc_version}"
implementation "io.grpc:grpc-protobuf:${grpc_version}"
implementation "io.grpc:grpc-stub:${grpc_version}"
implementation "io.grpc:grpc-services:${grpc_version}"

implementation "com.github.pambrose.common-utils:core-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:corex-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:dropwizard-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:guava-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:grpc-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:jetty-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:ktor-client-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:prometheus-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:service-utils:${utils_version}"
implementation "com.github.pambrose.common-utils:zipkin-utils:${utils_version}"
implementation "io.grpc:grpc-kotlin-stub:${gengrpc_version}"

implementation "org.eclipse.jetty:jetty-servlet:${jetty_version}"
implementation "com.github.pambrose.common-utils:core-utils:$utils_version"
implementation "com.github.pambrose.common-utils:corex-utils:$utils_version"
implementation "com.github.pambrose.common-utils:dropwizard-utils:$utils_version"
implementation "com.github.pambrose.common-utils:guava-utils:$utils_version"
implementation "com.github.pambrose.common-utils:grpc-utils:$utils_version"
implementation "com.github.pambrose.common-utils:jetty-utils:$utils_version"
implementation "com.github.pambrose.common-utils:ktor-client-utils:$utils_version"
implementation "com.github.pambrose.common-utils:prometheus-utils:$utils_version"
implementation "com.github.pambrose.common-utils:service-utils:$utils_version"
implementation "com.github.pambrose.common-utils:zipkin-utils:$utils_version"

implementation "javax.annotation:javax.annotation-api:${annotation_version}"
implementation "com.beust:jcommander:${jcommander_version}"
implementation "com.typesafe:config:${typesafe_version}"
implementation "org.eclipse.jetty:jetty-servlet:$jetty_version"

implementation "io.prometheus:simpleclient:${prometheus_version}"
implementation "javax.annotation:javax.annotation-api:$annotation_version"
implementation "com.beust:jcommander:$jcommander_version"
implementation "com.typesafe:config:$typesafe_version"

implementation "io.ktor:ktor-server-core:${ktor_version}"
implementation "io.ktor:ktor-server-cio:${ktor_version}"
implementation "io.ktor:ktor-client-core:${ktor_version}"
implementation "io.ktor:ktor-client-cio:${ktor_version}"
implementation "io.prometheus:simpleclient:$prometheus_version"

implementation "io.dropwizard.metrics:metrics-healthchecks:${dropwizard_version}"
implementation "io.ktor:ktor-server-core:$ktor_version"
implementation "io.ktor:ktor-server-cio:$ktor_version"
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-cio:$ktor_version"

implementation "io.zipkin.brave:brave-instrumentation-grpc:${zipkin_version}"
implementation "io.dropwizard.metrics:metrics-healthchecks:$dropwizard_version"

implementation "ch.qos.logback:logback-classic:${logback_version}"
implementation "org.slf4j:jul-to-slf4j:${slf4j_version}"
implementation "io.github.microutils:kotlin-logging:${logging_version}"
implementation "io.zipkin.brave:brave-instrumentation-grpc:$zipkin_version"

testImplementation "org.amshove.kluent:kluent:${kluent_version}"
implementation "io.github.microutils:kotlin-logging:$logging_version"
implementation "ch.qos.logback:logback-classic:$logback_version"
implementation "org.slf4j:jul-to-slf4j:$slf4j_version"

testImplementation "org.amshove.kluent:kluent:$kluent_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}

/*
sourceSets {
main.java.srcDirs += ['src/main/java']
main.kotlin.srcDirs += ['src/main/kotlin']
test.java.srcDirs += ['src/test/java']
test.kotlin.srcDirs += ['src/test/kotlin']
main.resources.srcDirs += ['src/main/resources']
test.resources.srcDirs += ['src/main/testresources']
}
*/

compileKotlin.dependsOn ':generateProto'

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protoc_version}"
}
protoc { artifact = "com.google.protobuf:protoc:$protoc_version" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpc_version}" }
grpc { artifact = "io.grpc:protoc-gen-grpc-java:$grpc_version" }

// Specify protoc to generate using our grpc kotlin plugin
grpckt { artifact = "io.grpc:protoc-gen-grpc-kotlin:${gengrpc_version}" }
}
generateProtoTasks {
all()*.plugins {
grpc {}
all().each { task ->
task.plugins {
// Generate Java gRPC classes
grpc { }
// Generate Kotlin gRPC using the custom plugin from library
grpckt { }
}
}
}
}

compileKotlin.dependsOn ':generateProto'

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += ['-Xuse-experimental=kotlin.time.ExperimentalTime',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault',
'-Xuse-experimental=kotlin.ExperimentalUnsignedTypes',
'-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi',
'-Xuse-experimental=io.ktor.util.KtorExperimentalAPI',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault']
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += ['-Xuse-experimental=kotlin.time.ExperimentalTime',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault',
'-Xuse-experimental=kotlin.ExperimentalUnsignedTypes',
'-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi',
'-Xuse-experimental=io.ktor.util.KtorExperimentalAPI',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault']
}
}

configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
Expand Down Expand Up @@ -131,32 +182,6 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += ['-Xuse-experimental=kotlin.time.ExperimentalTime',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault',
'-Xuse-experimental=kotlin.ExperimentalUnsignedTypes',
'-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi',
'-Xuse-experimental=io.ktor.util.KtorExperimentalAPI',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault']
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += ['-Xuse-experimental=kotlin.time.ExperimentalTime',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault',
'-Xuse-experimental=kotlin.ExperimentalUnsignedTypes',
'-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi',
'-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi',
'-Xuse-experimental=io.ktor.util.KtorExperimentalAPI',
'-Xuse-experimental=kotlinx.serialization.UnstableDefault']
}
}

// Required for multiple uberjar targets
shadowJar {
mergeServiceFiles()
Expand Down
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.6.4'
image: 'pambrose/prometheus-proxy:1.7.0'
ports:
- '8080:8080'
- '8082:8082'
Expand Down
4 changes: 2 additions & 2 deletions etc/config/config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ proxy {
maxAgentInactivitySecs = 15 // Seconds of inactivity before agent is evicted
staleAgentCheckPauseSecs = 10 // Pause interval for agent cleanup

scrapeRequestTimeoutSecs = 5
scrapeRequestCheckMillis = 500
scrapeRequestTimeoutSecs = 5 // Timeout for scrape requests
scrapeRequestCheckMillis = 500 // Pause time between checks for scrape request timeout
scrapeRequestBacklogUnhealthySize = 25 // Threshold for returning an unhealthy healthcheck
scrapeRequestMapUnhealthySize = 25 // Threshold for returning an unhealthy healthcheck

Expand Down
24 changes: 16 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
kotlin.code.style=official
kotlin.incremental=true
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
annotation_version=1.3.2
coroutines_version=1.3.4
dropwizard_version=4.1.5
grpc_version=1.28.1
coroutines_version=1.3.6
dropwizard_version=4.1.9
gengrpc_version=0.1.3
grpc_version=1.30.1
jcommander_version=1.78
jetty_version=9.4.22.v20191022
junit_version=5.6.1
kluent_version=1.61
ktor_version=1.3.2
logback_version=1.2.3
logging_version=1.7.9
prometheus_version=0.8.1
protoc_version=3.11.4
logging_version=1.8.0.1
prometheus_version=0.9.0
protoc_version=3.12.3
serialization_version=0.20.0-1.3.70-eap-274-2
slf4j_version=1.7.28
typesafe_version=1.4.0
utils_version=b107c71
zipkin_version=5.11.2
utils_version=cca9a6d
zipkin_version=5.12.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Wed Mar 25 12:27:26 PDT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
Loading

0 comments on commit 2c9dfbc

Please sign in to comment.