Skip to content

Commit

Permalink
Kroto dc conversion (#92)
Browse files Browse the repository at this point in the history
* Add krotodc data classes
* Update jars
  • Loading branch information
pambrose authored May 16, 2023
1 parent 65c63f9 commit a162c6f
Show file tree
Hide file tree
Showing 21 changed files with 299 additions and 423 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.16.0
VERSION=1.17.0

default: versioncheck

Expand Down Expand Up @@ -68,4 +68,4 @@ refresh:
./gradlew --refresh-dependencies

upgrade-wrapper:
./gradlew wrapper --gradle-version=8.0.2 --distribution-type=bin
./gradlew wrapper --gradle-version=8.1.1 --distribution-type=bin
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ scrape_configs:
The docker images are available via:
```bash
docker pull pambrose/prometheus-proxy:1.16.0
docker pull pambrose/prometheus-agent:1.16.0
docker pull pambrose/prometheus-proxy:1.17.0
docker pull pambrose/prometheus-agent:1.17.0
```

Start a proxy container with:
Expand All @@ -122,15 +122,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.16.0
pambrose/prometheus-proxy:1.17.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.16.0
pambrose/prometheus-agent:1.17.0
```

Using the config
Expand All @@ -148,7 +148,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.16.0
pambrose/prometheus-agent:1.17.0
```

**Note:** The `WORKDIR` of the proxy and agent images is `/app`, so make sure to use `/app` as the base directory in the
Expand Down Expand Up @@ -296,15 +296,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.16.0
pambrose/prometheus-proxy:1.17.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.16.0
pambrose/prometheus-agent:1.17.0
```

**Note:** The `WORKDIR` of the proxy and agent images is `/app`, so make sure to use `/app` as the base directory in the
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.16.0
pambrose/prometheus-agent:1.17.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.16.0
pambrose/prometheus-proxy:1.17.0
22 changes: 17 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.8.20'
id 'com.google.protobuf' version '0.8.18' // Keep in sync with grpc
id 'org.jetbrains.kotlin.jvm' version '1.8.21'
id 'com.google.protobuf' version '0.9.1' // Keep in sync with grpc
id 'org.jmailen.kotlinter' version "3.13.0"
id "com.github.ben-manes.versions" version '0.46.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.github.gmazzo.buildconfig' version '3.1.0'
id 'com.github.gmazzo.buildconfig' version '4.0.4'
id 'org.jetbrains.kotlinx.kover' version '0.6.1'
// Turn these off until jacoco fixes their kotlin 1.5.0 SMAP issue
// id 'jacoco'
// id 'com.github.kt3k.coveralls' version '2.12.0'
}

group = 'io.prometheus'
version = '1.16.0'
version = '1.17.0'

sourceCompatibility = 11
targetCompatibility = 11
Expand All @@ -25,7 +25,7 @@ buildConfig {

buildConfigField('String', 'APP_NAME', "\"${project.name}\"")
buildConfigField('String', 'APP_VERSION', "\"${project.version}\"")
buildConfigField('String', 'APP_RELEASE_DATE', "\"04/11/2023\"")
buildConfigField('String', 'APP_RELEASE_DATE', "\"05/16/2023\"")
}

repositories {
Expand All @@ -46,6 +46,8 @@ dependencies {

implementation "io.grpc:grpc-kotlin-stub:$gengrpc_version"

implementation "io.github.mscheong01:krotoDC-core:$krotodc_version"

// Required
implementation "io.netty:netty-tcnative-boringssl-static:$tcnative_version"

Expand Down Expand Up @@ -123,12 +125,17 @@ protobuf {
grpckt {
artifact = "io.grpc:protoc-gen-grpc-kotlin:$gengrpc_version:jdk8@jar"
}

krotoDC {
artifact = "io.github.mscheong01:protoc-gen-krotoDC:$krotodc_version:jdk8@jar"
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
grpc {} // Generate Java gRPC classes
grpckt {} // Generate Kotlin gRPC using the custom plugin from library
krotoDC {} // Generate Kotlin data classes
}
// task.builtins {
// kotlin {}
Expand Down Expand Up @@ -245,6 +252,11 @@ test {
}
}

// This will keep generated code out of the kotlinter checks
tasks.named("lintKotlinMain") {
source = source - fileTree("$buildDir/generated")
}

kotlinter {
ignoreFailures = false
//indentSize = 2
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.16.0'
image: 'pambrose/prometheus-proxy:1.17.0'
ports:
- '8080:8080'
- '8082:8082'
Expand Down
25 changes: 13 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@ org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
annotation_version=1.3.2
dropwizard_version=4.2.18
gengrpc_version=1.3.0
grpc_version=1.54.0
grpc_version=1.55.1
jcommander_version=1.82
jetty_version=10.0.14
junit_version=5.9.2
kluent_version=1.72
kotlin_version=1.8.20
ktor_version=2.2.4
logback_version=1.4.6
jetty_version=10.0.15
junit_version=5.9.3
kluent_version=1.73
kotlin_version=1.8.21
krotodc_version=1.0.1
ktor_version=2.3.0
logback_version=1.4.7
logging_version=4.0.0-beta-2
# Keep in sync with grpc
tcnative_version=2.0.59.Final
prometheus_version=0.16.0
# Keep in sync with grpc
protoc_version=3.21.7
serialization_version=1.5.0
protoc_version=3.22.3
serialization_version=1.5.1
slf4j_version=2.0.7
typesafe_version=1.4.2
utils_version=1.35.0
zipkin_version=5.15.0
utils_version=1.38.0
zipkin_version=5.16.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 6 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -144,15 +141,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/prometheus/Proxy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import io.prometheus.common.ConfigVals
import io.prometheus.common.ConfigWrappers.newAdminConfig
import io.prometheus.common.ConfigWrappers.newMetricsConfig
import io.prometheus.common.ConfigWrappers.newZipkinConfig
import io.prometheus.common.GrpcObjects.EMPTY_AGENT_ID_MSG
import io.prometheus.common.Messages.EMPTY_AGENT_ID_MSG
import io.prometheus.common.getVersionDesc
import io.prometheus.proxy.AgentContext
import io.prometheus.proxy.AgentContextCleanupService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import io.grpc.ForwardingClientCallListener
import io.grpc.Metadata
import io.grpc.MethodDescriptor
import io.prometheus.Agent
import io.prometheus.common.GrpcObjects.EMPTY_AGENT_ID_MSG
import io.prometheus.common.Messages.EMPTY_AGENT_ID_MSG
import io.prometheus.proxy.ProxyServerInterceptor.Companion.META_AGENT_ID_KEY
import mu.two.KLogging

Expand Down
Loading

0 comments on commit a162c6f

Please sign in to comment.