Skip to content

Commit

Permalink
1.14.0 (#76)
Browse files Browse the repository at this point in the history
* Add support for Agent scrapeMaxRetries
* Upgrade to ktor 2.1.0
* Upgrade to kotlin 1.7.10
* Upgrade to gRPC 1.49.0
* Upgrade to dropwizard 4.2.11
  • Loading branch information
pambrose authored Aug 31, 2022
1 parent 92ff24c commit 6d7fd51
Show file tree
Hide file tree
Showing 35 changed files with 531 additions and 361 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.13.0
VERSION=1.14.0

default: versioncheck

Expand All @@ -19,6 +19,9 @@ jars:
tests:
./gradlew --rerun-tasks check

reports:
./gradlew koverMergedHtmlReport

config:
java -jar ./etc/jars/tscfg-0.9.997.jar --spec etc/config/config.conf --pn io.prometheus.common --cn ConfigVals --dd src/main/java/io/prometheus/common

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

upgrade-wrapper:
./gradlew wrapper --gradle-version=7.4 --distribution-type=bin
./gradlew wrapper --gradle-version=7.5.1 --distribution-type=bin
59 changes: 30 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Prometheus Proxy

[![JitPack](https://jitpack.io/v/pambrose/prometheus-proxy.svg)](https://jitpack.io/#pambrose/prometheus-proxy)
[![Build Status](https://travis-ci.org/pambrose/prometheus-proxy.svg?branch=master)](https://travis-ci.org/pambrose/prometheus-proxy)
[![Build Status](https://app.travis-ci.com/pambrose/prometheus-proxy.svg?branch=master)](https://app.travis-ci.com/pambrose/prometheus-proxy)
[![codebeat badge](https://codebeat.co/badges/8dbe1dc6-628e-44a4-99f9-d468831ff0cc)](https://codebeat.co/projects/github-com-pambrose-prometheus-proxy-master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/422df508473443df9fbd8ea00fdee973)](https://www.codacy.com/app/pambrose/prometheus-proxy?utm_source=github.com&utm_medium=referral&utm_content=pambrose/prometheus-proxy&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/pambrose/prometheus-proxy/branch/master/graph/badge.svg)](https://codecov.io/gh/pambrose/prometheus-proxy)
Expand Down Expand Up @@ -112,8 +112,8 @@ scrape_configs:
The docker images are available via:
```bash
docker pull pambrose/prometheus-proxy:1.13.0
docker pull pambrose/prometheus-agent:1.13.0
docker pull pambrose/prometheus-proxy:1.14.0
docker pull pambrose/prometheus-agent:1.14.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.13.0
pambrose/prometheus-proxy:1.14.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.13.0
pambrose/prometheus-agent:1.14.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.13.0
pambrose/prometheus-agent:1.14.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 @@ -202,27 +202,28 @@ argument is an agent config value, which should have an `agent.pathConfigs` valu

### Agent CLI Options

| Options | ENV VAR<br>Property | Default | Description |
|:----------------------|:---------------------------------------------------------------------------|:--------|:-----------------------------------------------------------|
| --config, -c | AGENT_CONFIG | | Agent config file or url (required) |
| --proxy, -p | PROXY_HOSTNAME <br> agent.proxy.hostname | | Proxy hostname (can include :port) |
| --name, -n | AGENT_NAME <br> agent.name | | Agent name |
| --admin, -r | ADMIN_ENABLED <br> agent.admin.enabled | false | Enable admin servlets |
| --admin_port, -i | ADMIN_PORT <br> agent.admin.port | 8093 | Admin servlets port |
| --debug, -b | DEBUG_ENABLED <br> agent.admin.debugEnabled | false | Enable agent debug servlet<br>on admin port |
| --metrics, -e | METRICS_ENABLED <br> agent.metrics.enabled | false | Enable agent metrics |
| --metrics_port, -m | METRICS_PORT <br> agent.metrics.port | 8083 | Agent metrics listen port |
| --consolidated, -o | CONSOLIDATED <br> agent.consolidated | false | Enable multiple agents per registered path |
| --timeout | SCRAPE_TIMEOUT_SECS <br> agent.scrapeTimeoutSecs | 15 | Scrape timeout time (seconds) |
| --chunk | CHUNK_CONTENT_SIZE_KBS <br> agent.chunkContentSizeKbs | 32 | Threshold for chunking data to Proxy and buffer size (KBs) |
| --gzip | MIN_GZIP_SIZE_BYTES <br> agent.minGzipSizeBytes | 1024 | Minimum size for content to be gzipped (bytes) |
| --cert, -t | CERT_CHAIN_FILE_PATH <br> agent.tls.certChainFilePath | | Certificate chain file path |
| --key, -k | PRIVATE_KEY_FILE_PATH <br> agent.tls.privateKeyFilePath | | Private key file path |
| --trust, -s | TRUST_CERT_COLLECTION_FILE_PATH <br> agent.tls.trustCertCollectionFilePath | | Trust certificate collection file path |
| --override | OVERRIDE_AUTHORITY <br> agent.tls.overrideAuthority | | Override authority (for testing) |
| --version, -v | | | Print version info and exit |
| --usage, -u | | | Print usage message and exit |
| -D | | | Dynamic property assignment |
| Options | ENV VAR<br>Property | Default | Description |
|:-------------------|:---------------------------------------------------------------------------|:--------|:-----------------------------------------------------------|
| --config, -c | AGENT_CONFIG | | Agent config file or url (required) |
| --proxy, -p | PROXY_HOSTNAME <br> agent.proxy.hostname | | Proxy hostname (can include :port) |
| --name, -n | AGENT_NAME <br> agent.name | | Agent name |
| --admin, -r | ADMIN_ENABLED <br> agent.admin.enabled | false | Enable admin servlets |
| --admin_port, -i | ADMIN_PORT <br> agent.admin.port | 8093 | Admin servlets port |
| --debug, -b | DEBUG_ENABLED <br> agent.admin.debugEnabled | false | Enable agent debug servlet<br>on admin port |
| --metrics, -e | METRICS_ENABLED <br> agent.metrics.enabled | false | Enable agent metrics |
| --metrics_port, -m | METRICS_PORT <br> agent.metrics.port | 8083 | Agent metrics listen port |
| --consolidated, -o | CONSOLIDATED <br> agent.consolidated | false | Enable multiple agents per registered path |
| --timeout | SCRAPE_TIMEOUT_SECS <br> agent.scrapeTimeoutSecs | 15 | Scrape timeout time (seconds) |
| --max_retries | SCRAPE_MAX_RETRIES <br> agent.scrapeMaxRetries | 0 | Scrape maximum retries (0 disables scrape retries) |
| --chunk | CHUNK_CONTENT_SIZE_KBS <br> agent.chunkContentSizeKbs | 32 | Threshold for chunking data to Proxy and buffer size (KBs) |
| --gzip | MIN_GZIP_SIZE_BYTES <br> agent.minGzipSizeBytes | 1024 | Minimum size for content to be gzipped (bytes) |
| --cert, -t | CERT_CHAIN_FILE_PATH <br> agent.tls.certChainFilePath | | Certificate chain file path |
| --key, -k | PRIVATE_KEY_FILE_PATH <br> agent.tls.privateKeyFilePath | | Private key file path |
| --trust, -s | TRUST_CERT_COLLECTION_FILE_PATH <br> agent.tls.trustCertCollectionFilePath | | Trust certificate collection file path |
| --override | OVERRIDE_AUTHORITY <br> agent.tls.overrideAuthority | | Override authority (for testing) |
| --version, -v | | | Print version info and exit |
| --usage, -u | | | Print usage message and exit |
| -D | | | Dynamic property assignment |

Misc notes:

Expand Down Expand Up @@ -292,15 +293,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.13.0
pambrose/prometheus-proxy:1.14.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.13.0
pambrose/prometheus-agent:1.14.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.13.0
pambrose/prometheus-agent:1.14.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.13.0
pambrose/prometheus-proxy:1.14.0
57 changes: 38 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,46 @@ plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
id 'com.google.protobuf' version '0.8.18'
id 'org.jmailen.kotlinter' version "3.9.0"
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
id 'com.google.protobuf' version '0.8.19'
id 'org.jmailen.kotlinter' version "3.11.1"
id "com.github.ben-manes.versions" version '0.42.0'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.gmazzo.buildconfig' version '3.0.3'
id 'com.github.gmazzo.buildconfig' version '3.1.0'
//id 'org.jetbrains.kotlinx.kover' version '0.5.0'
// 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.13.0'
version = '1.14.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
maven { url 'https://maven.pkg.jetbrains.space/public/p/ktor/eap'; name 'ktor-eap' }
//maven { url "https://maven.pkg.jetbrains.space/public/p/ktor/eap" }
google()
mavenCentral()
maven { url = 'https://jitpack.io' }
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version"

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"

implementation "io.grpc:grpc-netty:$grpc_version"
implementation "io.grpc:grpc-protobuf:$grpc_version"
implementation "io.grpc:grpc-stub:$grpc_version"
implementation "io.grpc:grpc-services:$grpc_version"

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

// Required
implementation "io.netty:netty-tcnative-boringssl-static:$tcnative_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"
Expand All @@ -60,12 +61,15 @@ dependencies {

implementation "io.prometheus:simpleclient:$prometheus_version"

implementation "io.ktor:ktor-server:$ktor_version"
implementation "io.ktor:ktor-server-cio:$ktor_version"
implementation "io.ktor:ktor-client:$ktor_version"
implementation "io.ktor:ktor-client-cio:$ktor_version"
implementation "io.ktor:ktor-client-auth:$ktor_version"

implementation "io.ktor:ktor-server:$ktor_version"
implementation "io.ktor:ktor-server-cio:$ktor_version"
implementation "io.ktor:ktor-server-call-logging:$ktor_version"
implementation "io.ktor:ktor-server-compression:$ktor_version"

implementation "io.dropwizard.metrics:metrics-healthchecks:$dropwizard_version"

implementation "io.zipkin.brave:brave-instrumentation-grpc:$zipkin_version"
Expand All @@ -80,9 +84,11 @@ dependencies {
}

buildConfig {
packageName("io.prometheus")

buildConfigField('String', 'APP_NAME', "\"${project.name}\"")
buildConfigField('String', 'APP_VERSION', "\"${project.version}\"")
buildConfigField('String', 'APP_RELEASE_DATE', "\"3/3/22\"")
buildConfigField('String', 'APP_RELEASE_DATE', "\"9/30/22\"")
}

publishing {
Expand Down Expand Up @@ -114,17 +120,18 @@ protobuf {

// Specify protoc to generate using our grpc kotlin plugin
grpckt {
artifact = "io.grpc:protoc-gen-grpc-kotlin:$gengrpc_version:jdk7@jar"
artifact = "io.grpc:protoc-gen-grpc-kotlin:$gengrpc_version:jdk8@jar"
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
// Generate Java gRPC classes
grpc {}
// Generate Kotlin gRPC using the custom plugin from library
grpckt {}
grpc {} // Generate Java gRPC classes
grpckt {} // Generate Kotlin gRPC using the custom plugin from library
}
// task.builtins {
// kotlin {}
// }
}
}
}
Expand All @@ -140,6 +147,9 @@ task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
}

// This is to fix a bizarre gradle error related to duplicate Agent.toString() methods
project.getTasks().getByName("jar").setProperty("duplicatesStrategy", DuplicatesStrategy.INCLUDE);

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
Expand All @@ -154,6 +164,7 @@ java {
withSourcesJar()
}


//jacocoTestReport {
// reports {
// xml.enabled true
Expand Down Expand Up @@ -235,8 +246,16 @@ test {

kotlinter {
ignoreFailures = false
indentSize = 2
//indentSize = 2
reporters = ['checkstyle', 'plain']
experimentalRules = false
disabledRules = ["no-wildcard-imports", "indent", "final-newline", "comment-spacing", "max-line-length", "no-multi-spaces", "no-trailing-spaces"]
disabledRules = ["no-wildcard-imports",
"indent",
"final-newline",
"comment-spacing",
"max-line-length",
"no-multi-spaces",
"no-trailing-spaces",
"wrapping",
"multiline-if-else",]
}
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.13.0'
image: 'pambrose/prometheus-proxy:1.14.0'
ports:
- '8080:8080'
- '8082:8082'
Expand Down
1 change: 1 addition & 0 deletions etc/config/config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ agent {
minGzipSizeBytes = 512 // Minimum size for content to be gzipped

scrapeTimeoutSecs = 15 // Scrape timeout time in seconds
scrapeMaxRetries = 0 // Maximum scrape retries (0 disables scrape retries)

proxy {
hostname = "localhost" // Proxy hostname
Expand Down
34 changes: 18 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@ org.gradle.parallel=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
annotation_version=1.3.2
coroutines_version=1.6.0
dropwizard_version=4.2.8
gengrpc_version=1.2.1
grpc_version=1.44.1
dropwizard_version=4.2.11
gengrpc_version=1.3.0
grpc_version=1.49.0
jcommander_version=1.82
jetty_version=9.4.44.v20210927
junit_version=5.8.2
jetty_version=9.4.48.v20220622
junit_version=5.9.0
kluent_version=1.68
kotlin_version=1.6.10
ktor_version=2.0.0-beta-1
logback_version=1.2.10
logging_version=2.1.21
prometheus_version=0.15.0
protoc_version=3.19.1
serialization_version=1.3.2
slf4j_version=1.7.36
kotlin_version=1.7.10
ktor_version=2.1.0
logback_version=1.4.0
logging_version=2.1.23
# Keep in sync with grpc
tcnative_version=2.0.54.Final
prometheus_version=0.16.0
# Keep in sync with grpc
protoc_version=3.21.1
serialization_version=1.4.0
slf4j_version=2.0.0
typesafe_version=1.4.2
utils_version=1.22.0
zipkin_version=5.13.7
utils_version=1.28.0
zipkin_version=5.13.11
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,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading

0 comments on commit 6d7fd51

Please sign in to comment.