Skip to content

Commit

Permalink
1.7.1
Browse files Browse the repository at this point in the history
* Make agent embeddable
* Fix problem in agent cleanup removal
  • Loading branch information
pambrose authored Aug 13, 2020
1 parent 2c9dfbc commit a1e8d04
Show file tree
Hide file tree
Showing 39 changed files with 901 additions and 771 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.7.0
VERSION=1.7.1

default: compile

Expand All @@ -17,10 +17,10 @@ jars:
./gradlew agentJar proxyJar

tests:
./gradlew check jacocoTestReport
./gradlew --rerun-tasks check jacocoTestReport

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

distro: clean compile jars

Expand Down Expand Up @@ -51,7 +51,7 @@ site:
./mvnw site

tree:
./mvnw dependency:tree
./gradlew -q dependencies

versioncheck:
./gradlew dependencyUpdates
Expand Down
49 changes: 25 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@ Start an `agent` with:
java -jar prometheus-agent.jar -Dagent.proxy.hostname=mymachine.local --config https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/myapps.conf
```

If prometheus-proxy were running on a machine named *mymachine.local* and the
If the prometheus-proxy were running on a machine named *mymachine.local* and the
`agent.pathConfigs` value in the [myapps.conf](https://raw.githubusercontent.com/pambrose/prometheus-proxy/master/examples/myapps.conf)
config file had the contents:

```hocon
agent {
pathConfigs: [
{
name: "app1 name"
name: "App1 metrics"
path: app1_metrics
url: "http://app1.local:9100/metrics"
},
{
name: "app2 name"
name: "App2 metrics"
path: app2_metrics
url: "http://app2.local:9100/metrics"
},
{
name: "app3 name"
name: "App3 metrics"
path: app3_metrics
url: "http://app3.local:9100/metrics"
}
Expand All @@ -79,15 +79,15 @@ The `prometheus.yml` file would include:

```yaml
scrape_configs:
- job_name: 'app1'
- job_name: 'app1 metrics'
metrics_path: '/app1_metrics'
static_configs:
- targets: ['mymachine.local:8080']
- job_name: 'app2'
- job_name: 'app2 metrics'
metrics_path: '/app2_metrics'
static_configs:
- targets: ['mymachine.local:8080']
- job_name: 'app3'
- job_name: 'app3 metrics'
metrics_path: '/app3_metrics'
static_configs:
- targets: ['mymachine.local:8080']
Expand All @@ -97,8 +97,8 @@ scrape_configs:
The docker images are available via:
```bash
docker pull pambrose/prometheus-proxy:1.7.0
docker pull pambrose/prometheus-agent:1.7.0
docker pull pambrose/prometheus-proxy:1.7.1
docker pull pambrose/prometheus-agent:1.7.1
```

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.7.0
pambrose/prometheus-proxy:1.7.1
```

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.7.0
pambrose/prometheus-agent:1.7.1
```

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.7.0
pambrose/prometheus-agent:1.7.1
```

**Note:** The `WORKDIR` of the proxy and agent images is `/app`, so make sure
Expand All @@ -153,7 +153,7 @@ The only required argument is an agent config value, which should have an `agent

| Options | ENV VAR<br>Property |Default | Description |
|-----------------------|-------------------------------------------------|--------|-------------------------------------|
| --config, -c | PROXY_CONFIG | | Agent config file or url |
| --config, -c | PROXY_CONFIG | | Agent config file or url |
| --port, -p | PROXY_PORT <br> proxy.http.port | 8080 | Proxy listen port |
| --agent_port, -a | AGENT_PORT <br> proxy.agent.port | 50051 | gRPC listen port for agents |
| --admin, -r | ADMIN_ENABLED <br> proxy.admin.enabled | false | Enable admin servlets |
Expand All @@ -173,23 +173,24 @@ The only required argument is an agent config value, which should have an `agent

| Options | ENV VAR<br>Property |Default | Description |
|:----------------------|:------------------------------------------------|:-------|:------------------------------------|
| --config, -c | AGENT_CONFIG | | Agent config file or url (required) |
| --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 |
| --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 |
| --consolidated, -o | CONSOLIDATED <br> agent.consolidated | false | Enable multiple agents per registered path |
| --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 |
| --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:
* If you want to customize the logging, include the java arg `-Dlogback.configurationFile=/path/to/logback.xml`
Expand Down Expand Up @@ -250,15 +251,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.7.0
pambrose/prometheus-proxy:1.7.1

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.7.0
pambrose/prometheus-agent:1.7.1
```

**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.7.0
pambrose/prometheus-agent:1.7.1
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.7.0
pambrose/prometheus-proxy:1.7.1
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ plugins {
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.ben-manes.versions" version '0.29.0'
id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.10.1'
id 'com.github.kt3k.coveralls' version '2.10.2'
}

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

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -32,8 +32,8 @@ dependencies {
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-netty-shaded:${grpc_version}"
//implementation "io.grpc:grpc-netty-shaded:${grpc_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}"
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.7.0'
image: 'pambrose/prometheus-proxy:1.7.1'
ports:
- '8080:8080'
- '8082:8082'
Expand Down
2 changes: 2 additions & 0 deletions etc/config/config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ proxy {
agent {
name = "" // Agent name used in metrics reporting

consolidated = false

// See: https://github.com/grpc/grpc.github.io/issues/371
chunkContentSizeKbs = 32 // Threshold for chunking data to Proxy and buffer size
minGzipSizeBytes = 512 // Minimum size for content to be gzipped
Expand Down
Binary file not shown.
6 changes: 3 additions & 3 deletions examples/myapps.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
agent {
pathConfigs: [
{
name: app1
name: "App1 metrics"
path: app1_metrics
url: "http://app1.local:9100/metrics"
},
{
name: app2
name: "App2 metrics"
path: app2_metrics
url: "http://app2.local:9100/metrics"
},
{
name: app3
name: "App3 metrics"
path: app3_metrics
url: "http://app3.local:9100/metrics"
}
Expand Down
17 changes: 12 additions & 5 deletions examples/simple.conf
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
proxy {
admin.debugEnabled = true

admin.enabled: true
metrics.enabled: true
}

agent {
proxy.hostname = ${HOSTNAME}

consolidated = true

proxy.hostname = localhost
admin.enabled: true
metrics.enabled: true

pathConfigs: [
{
name: proxy
name: "Proxy metrics"
path: proxy_metrics
url: "http://"${HOSTNAME}":8082/metrics"
url: "http://localhost:8082/metrics"
url: "http://"${?HOSTNAME}":8082/metrics"
}
{
name: agent
name: "Agent metrics"
path: agent_metrics
url: "http://"${HOSTNAME}":8083/metrics"
url: "http://localhost:8083/metrics"
url: "http://"${?HOSTNAME}":8083/metrics"
}
]
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ 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.6
dropwizard_version=4.1.9
gengrpc_version=0.1.3
grpc_version=1.30.1
dropwizard_version=4.1.11
gengrpc_version=0.1.4
grpc_version=1.31.0
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.8.0.1
logging_version=1.8.3
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=cca9a6d
zipkin_version=5.12.3
utils_version=1.1.20
zipkin_version=5.12.4
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-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 0 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
/*
* This file was generated by the Gradle 'init' task.
*/

rootProject.name = 'prometheus-proxy'
Loading

0 comments on commit a1e8d04

Please sign in to comment.