Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add prometheus jmx exporter in Dockerfile and upgrade depot #222

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
FROM adoptopenjdk:8-jdk-openj9 AS GRADLE_BUILD
RUN mkdir -p ./build/libs/
RUN curl -L http://search.maven.org/remotecontent?filepath=org/jolokia/jolokia-jvm/1.6.2/jolokia-jvm-1.6.2-agent.jar -o ./jolokia-jvm-agent.jar
RUN curl -L https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/1.0.1/jmx_prometheus_javaagent-1.0.1.jar -o ./jmx_prometheus_javaagent.jar
COPY ./ ./
RUN ./gradlew build

FROM openjdk:8-jre
COPY --from=GRADLE_BUILD ./build/libs/ /opt/firehose/bin
COPY --from=GRADLE_BUILD ./jolokia-jvm-agent.jar /opt/firehose
COPY --from=GRADLE_BUILD ./jmx_prometheus_javaagent.jar /opt/firehose
COPY --from=GRADLE_BUILD ./src/main/resources/log4j.xml /opt/firehose/etc/log4j.xml
COPY --from=GRADLE_BUILD ./src/main/resources/logback.xml /opt/firehose/etc/logback.xml
COPY ./jmx_exporter_config.yml /opt/firehose/etc/jmx_exporter_config.yml
WORKDIR /opt/firehose
CMD ["java", "-cp", "bin/*:/work-dir/*", "org.raystack.firehose.launch.Main", "-server", "-Dlogback.configurationFile=etc/firehose/logback.xml", "-Xloggc:/var/log/firehose"]
EXPOSE 8778/tcp
EXPOSE 9404/tcp
CMD ["java", \
"-javaagent:/opt/firehose/jmx_prometheus_javaagent.jar=9404:/opt/firehose/etc/jmx_exporter_config.yml", \
punit-kulal marked this conversation as resolved.
Show resolved Hide resolved
"-cp", "bin/*:/work-dir/*", \
"org.raystack.firehose.launch.Main", \
"-server", \
"-Dlogback.configurationFile=etc/firehose/logback.xml", \
"-Xloggc:/var/log/firehose"]
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.7"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:5.2.5"
classpath "org.ajoberstar:gradle-git:1.6.0"
}
}
Expand Down Expand Up @@ -33,7 +33,7 @@ lombok {
}

group 'org.raystack'
version '0.8.0'
version '0.8.1'

def projName = "firehose"

Expand Down Expand Up @@ -101,7 +101,7 @@ dependencies {
implementation platform('com.google.cloud:libraries-bom:20.5.0')
implementation 'com.google.cloud:google-cloud-storage:2.20.1'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation group: 'org.raystack', name: 'depot', version: '0.4.0'
implementation group: 'org.raystack', name: 'depot', version: '0.4.1'
implementation group: 'com.networknt', name: 'json-schema-validator', version: '1.0.59' exclude group: 'org.slf4j'

testImplementation group: 'junit', name: 'junit', version: '4.11'
Expand Down
28 changes: 28 additions & 0 deletions jmx_exporter_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
rules:
- pattern: "java.lang<type=Memory><HeapMemoryUsage>.*"
- pattern: "java.lang<type=GarbageCollector,name=*>"
- pattern: "java.lang<type=Threading><DaemonThreadCount>"
- pattern: "java.lang<type=OperatingSystem><SystemCpuLoad>"

- pattern: 'kafka.consumer<type=consumer-fetch-manager-metrics, client-id=(.+), topic=(.+), partition=(.+)><>([a-zA-Z0-9-_]+)'
name: kafka_consumer_fetch_manager_metrics_$4
type: GAUGE
labels:
client_id: "$1"
topic: "$2"
partition: "$3"
help: "Kafka consumer fetch manager metrics $4 for client_id $1 topic $2 and partition $3"

- pattern: 'kafka.consumer<type=consumer-coordinator-metrics, client-id=(.+)><>([a-zA-Z0-9-_]+)'
name: kafka_consumer_coordinator_metrics_$2
type: GAUGE
labels:
client_id: "$1"
help: "Kafka consumer coordinator metrics $2 for client_id $1"

- pattern: 'kafka.consumer<type=consumer-metrics, client-id=(.+)><>([a-zA-Z0-9-_]+)'
name: kafka_consumer_consumer_metrics_$2
type: GAUGE
labels:
client_id: "$1"
help: "Kafka consumer consumer metrics $2 for client_id $1"
Loading