Skip to content

Commit

Permalink
1.16.0 (#90)
Browse files Browse the repository at this point in the history
* Update jars and go to Kotlin 1.8.20
  • Loading branch information
pambrose authored Apr 11, 2023
1 parent 08faa6b commit 65c63f9
Show file tree
Hide file tree
Showing 52 changed files with 130 additions and 98 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.15.0
VERSION=1.16.0

default: versioncheck

Expand Down Expand Up @@ -27,7 +27,8 @@ config:

distro: clean compile jars

PLATFORMS := linux/amd64,linux/arm64/v8,linux/s390x,linux/ppc64le
#PLATFORMS := linux/amd64,linux/arm64/v8,linux/s390x,linux/ppc64le
PLATFORMS := linux/amd64,linux/arm64/v8,linux/s390x
IMAGE_PREFIX := pambrose/prometheus

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

upgrade-wrapper:
./gradlew wrapper --gradle-version=7.6 --distribution-type=bin
./gradlew wrapper --gradle-version=8.0.2 --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.15.0
docker pull pambrose/prometheus-agent:1.15.0
docker pull pambrose/prometheus-proxy:1.16.0
docker pull pambrose/prometheus-agent:1.16.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.15.0
pambrose/prometheus-proxy:1.16.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.15.0
pambrose/prometheus-agent:1.16.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.15.0
pambrose/prometheus-agent:1.16.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.15.0
pambrose/prometheus-proxy:1.16.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.15.0
pambrose/prometheus-agent:1.16.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.15.0
pambrose/prometheus-agent:1.16.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.15.0
pambrose/prometheus-proxy:1.16.0
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.7.21'
id 'org.jetbrains.kotlin.jvm' version '1.8.20'
id 'com.google.protobuf' version '0.8.18' // Keep in sync with grpc
id 'org.jmailen.kotlinter' version "3.12.0"
id "com.github.ben-manes.versions" version '0.44.0'
id 'com.github.johnrengelman.shadow' version '7.1.2'
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 'org.jetbrains.kotlinx.kover' version '0.6.1'
// Turn these off until jacoco fixes their kotlin 1.5.0 SMAP issue
Expand All @@ -15,7 +15,7 @@ plugins {
}

group = 'io.prometheus'
version = '1.15.0'
version = '1.16.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', "\"12/14/22\"")
buildConfigField('String', 'APP_RELEASE_DATE', "\"04/11/2023\"")
}

repositories {
Expand Down Expand Up @@ -144,15 +144,15 @@ configurations.all {
//startScripts.enabled = false

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
archiveClassifier = 'sources'
}

// 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'
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

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.15.0'
image: 'pambrose/prometheus-proxy:1.16.0'
ports:
- '8080:8080'
- '8082:8082'
Expand Down
26 changes: 13 additions & 13 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +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
dropwizard_version=4.2.13
dropwizard_version=4.2.18
gengrpc_version=1.3.0
grpc_version=1.51.1
grpc_version=1.54.0
jcommander_version=1.82
jetty_version=10.0.13
junit_version=5.9.1
jetty_version=10.0.14
junit_version=5.9.2
kluent_version=1.72
kotlin_version=1.7.21
ktor_version=2.2.1
logback_version=1.4.5
logging_version=3.0.4
kotlin_version=1.8.20
ktor_version=2.2.4
logback_version=1.4.6
logging_version=4.0.0-beta-2
# Keep in sync with grpc
tcnative_version=2.0.54.Final
tcnative_version=2.0.59.Final
prometheus_version=0.16.0
# Keep in sync with grpc
protoc_version=3.21.7
serialization_version=1.4.1
slf4j_version=2.0.6
serialization_version=1.5.0
slf4j_version=2.0.7
typesafe_version=1.4.2
utils_version=1.32.0
zipkin_version=5.14.1
utils_version=1.35.0
zipkin_version=5.15.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
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"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
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
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
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
25 changes: 25 additions & 0 deletions src/main/java/io/prometheus/common/ConfigVals.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright © 2023 Paul Ambrose (pambrose@mac.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// generated by tscfg 0.9.997 on Mon Nov 28 23:31:57 PST 2022
// source: etc/config/config.conf

Expand All @@ -6,6 +22,7 @@
public class ConfigVals {
public final ConfigVals.Agent agent;
public final ConfigVals.Proxy2 proxy;

public ConfigVals(com.typesafe.config.Config c) {
final $TsCfgValidator $tsCfgValidator = new $TsCfgValidator();
final java.lang.String parentPath = "";
Expand All @@ -29,6 +46,7 @@ public static class Agent {
public final int scrapeTimeoutSecs;
public final Agent.Tls tls;
public final boolean transportFilterDisabled;

public Agent(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) {
this.admin = c.hasPathOrNull("admin") ? new Agent.Admin(c.getConfig("admin"), parentPath + "admin.", $tsCfgValidator) : new Agent.Admin(com.typesafe.config.ConfigFactory.parseString("admin{}"), parentPath + "admin.", $tsCfgValidator);
this.chunkContentSizeKbs = c.hasPathOrNull("chunkContentSizeKbs") ? c.getInt("chunkContentSizeKbs") : 32;
Expand Down Expand Up @@ -90,6 +108,7 @@ public static class Internal {
public final int reconnectPauseSecs;
public final int scrapeRequestBacklogUnhealthySize;
public final Internal.Zipkin zipkin;

public Internal(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) {
this.cioTimeoutSecs = c.hasPathOrNull("cioTimeoutSecs") ? c.getInt("cioTimeoutSecs") : 90;
this.heartbeatCheckPauseMillis = c.hasPathOrNull("heartbeatCheckPauseMillis") ? c.getInt("heartbeatCheckPauseMillis") : 500;
Expand Down Expand Up @@ -130,6 +149,7 @@ public static class Metrics {
public final boolean standardExportsEnabled;
public final boolean threadExportsEnabled;
public final boolean versionInfoExportsEnabled;

public static class Grpc {
public final boolean allMetricsReported;
public final boolean metricsEnabled;
Expand Down Expand Up @@ -164,6 +184,7 @@ public static class PathConfigs$Elm {
this.path = $_reqStr(parentPath, c, "path", $tsCfgValidator);
this.url = $_reqStr(parentPath, c, "url", $tsCfgValidator);
}

private static java.lang.String $_reqStr(java.lang.String parentPath, com.typesafe.config.Config c, java.lang.String path, $TsCfgValidator $tsCfgValidator) {
if (c == null) return null;
try {
Expand Down Expand Up @@ -210,6 +231,7 @@ public static class Proxy2 {
public final Proxy2.Service service;
public final Proxy2.Tls2 tls;
public final boolean transportFilterDisabled;

public Proxy2(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) {
this.admin = c.hasPathOrNull("admin") ? new Proxy2.Admin2(c.getConfig("admin"), parentPath + "admin.", $tsCfgValidator) : new Proxy2.Admin2(com.typesafe.config.ConfigFactory.parseString("admin{}"), parentPath + "admin.", $tsCfgValidator);
this.agent = c.hasPathOrNull("agent") ? new Proxy2.Agent2(c.getConfig("agent"), parentPath + "agent.", $tsCfgValidator) : new Proxy2.Agent2(com.typesafe.config.ConfigFactory.parseString("agent{}"), parentPath + "agent.", $tsCfgValidator);
Expand Down Expand Up @@ -278,6 +300,7 @@ public static class Internal2 {
public final boolean staleAgentCheckEnabled;
public final int staleAgentCheckPauseSecs;
public final Internal2.Zipkin2 zipkin;

public Internal2(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) {
this.blitz = c.hasPathOrNull("blitz") ? new Internal2.Blitz(c.getConfig("blitz"), parentPath + "blitz.", $tsCfgValidator) : new Internal2.Blitz(com.typesafe.config.ConfigFactory.parseString("blitz{}"), parentPath + "blitz.", $tsCfgValidator);
this.chunkContextMapUnhealthySize = c.hasPathOrNull("chunkContextMapUnhealthySize") ? c.getInt("chunkContextMapUnhealthySize") : 25;
Expand Down Expand Up @@ -331,6 +354,7 @@ public static class Metrics2 {
public final boolean standardExportsEnabled;
public final boolean threadExportsEnabled;
public final boolean versionInfoExportsEnabled;

public static class Grpc2 {
public final boolean allMetricsReported;
public final boolean metricsEnabled;
Expand All @@ -357,6 +381,7 @@ public Metrics2(com.typesafe.config.Config c, java.lang.String parentPath, $TsCf

public static class Service {
public final Service.Discovery discovery;

public Service(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) {
this.discovery = c.hasPathOrNull("discovery") ? new Service.Discovery(c.getConfig("discovery"), parentPath + "discovery.", $tsCfgValidator) : new Service.Discovery(com.typesafe.config.ConfigFactory.parseString("discovery{}"), parentPath + "discovery.", $tsCfgValidator);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/io/prometheus/Agent.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2020 Paul Ambrose (pambrose@mac.com)
* Copyright © 2023 Paul Ambrose (pambrose@mac.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -54,7 +54,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import mu.KLogging
import mu.two.KLogging
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit.MILLISECONDS
import java.util.concurrent.atomic.AtomicInteger
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/io/prometheus/Proxy.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2020 Paul Ambrose (pambrose@mac.com)
* Copyright © 2023 Paul Ambrose (pambrose@mac.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,7 +47,7 @@ import io.prometheus.proxy.ProxyOptions
import io.prometheus.proxy.ProxyPathManager
import io.prometheus.proxy.ScrapeRequestManager
import kotlinx.coroutines.runBlocking
import mu.KLogging
import mu.two.KLogging
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import kotlin.time.Duration.Companion.milliseconds
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/io/prometheus/agent/AgentClientInterceptor.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2020 Paul Ambrose (pambrose@mac.com)
* Copyright © 2023 Paul Ambrose (pambrose@mac.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ import io.grpc.MethodDescriptor
import io.prometheus.Agent
import io.prometheus.common.GrpcObjects.EMPTY_AGENT_ID_MSG
import io.prometheus.proxy.ProxyServerInterceptor.Companion.META_AGENT_ID_KEY
import mu.KLogging
import mu.two.KLogging

internal class AgentClientInterceptor(private val agent: Agent) : ClientInterceptor {

Expand Down
Loading

0 comments on commit 65c63f9

Please sign in to comment.