Skip to content

Commit

Permalink
Merge pull request #78 from sysdiglabs/upgrade-1.0.0
Browse files Browse the repository at this point in the history
Upgrade 1.0.0
  • Loading branch information
eckelon authored Feb 20, 2024
2 parents 19f0e56 + 3edddb9 commit 7e5d66c
Showing 206 changed files with 5,392 additions and 3,990 deletions.
2 changes: 1 addition & 1 deletion MAINTAINER_NOTES.md
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ Checkout the `main` branch and increment the version

```shell
git checkout main
./tools/change-version.sh 0.20.1-SNAPSHOT
./tools/change-version.sh 1.0.0-SNAPSHOT
git add -u
git commit -m "prepare for next development iteration"
```
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,10 +2,12 @@
<img src="https://circleci.com/gh/prometheus/jmx_exporter.svg?style=shield"/>
</picture>


Sysdig CI/CD Pipeline in the [Prometheus Integrations repo](https://github.com/draios/prometheus-integrations/blob/main/build/Jenkinsfile).

JMX Exporter
=====


JMX to Prometheus exporter: a collector that can configurable scrape and
expose mBeans of a JMX target.

@@ -19,12 +21,12 @@ process metrics (e.g., memory and CPU usage).

## Running the Java Agent

- [jmx_prometheus_javaagent-0.19.0.jar](https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.19.0/jmx_prometheus_javaagent-0.19.0.jar)
- [jmx_prometheus_javaagent-0.20.0.jar](https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.20.0/jmx_prometheus_javaagent-0.20.0.jar)

To run as a Java agent, download one of the JARs and run:

```
java -javaagent:./jmx_prometheus_javaagent-0.19.0.jar=12345:config.yaml -jar yourJar.jar
java -javaagent:./jmx_prometheus_javaagent-0.20.0.jar=12345:config.yaml -jar yourJar.jar
```

Metrics will now be accessible at [http://localhost:12345/metrics](http://localhost:12345/metrics).
@@ -41,12 +43,12 @@ Example configurations can be found in the `example_configs/` directory.

## Running the Standalone HTTP Server

- [jmx_prometheus_httpserver-0.19.0.jar](https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_httpserver/0.19.0/jmx_prometheus_httpserver-0.19.0.jar)
- [jmx_prometheus_httpserver-0.20.0.jar](https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_httpserver/0.20.0/jmx_prometheus_httpserver-0.20.0.jar)

To run the standalone HTTP server, download one of the JARs and run:

```
java -jar jmx_prometheus_httpserver-0.19.0.jar 12345 config.yaml
java -jar jmx_prometheus_httpserver-0.20.0.jar 12345 config.yaml
```

Metrics will now be accessible at [http://localhost:12345/metrics](http://localhost:12345/metrics).
6 changes: 3 additions & 3 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ FROM anapsix/alpine-java:9 as scratch

RUN apk update && apk upgrade && apk --update add curl && rm -rf /tmp/* /var/cache/apk/*

ENV VERSION 0.20.1
ENV VERSION 1.0.0
ENV JAR jmx_prometheus_httpserver-$VERSION.jar
COPY --from=javabuilder /opt/jmx_exporter/jmx_prometheus_httpserver/target/jmx_prometheus_httpserver-$VERSION-SNAPSHOT.jar /opt/jmx_exporter/$JAR
COPY build/start.sh /opt/jmx_exporter
@@ -17,15 +17,15 @@ RUN chmod +x /opt/jmx_exporter/start.sh

CMD ["/opt/jmx_exporter/start.sh"]

FROM quay.io/sysdig/sysdig-mini-ubi9:1.2.0 as ubi
FROM quay.io/sysdig/sysdig-mini-ubi9:1.2.5 as ubi

RUN microdnf --assumeyes --disableplugin=subscription-manager --nodocs update && \
microdnf --assumeyes --disableplugin=subscription-manager --nodocs install java-1.8.0-openjdk && \
microdnf --assumeyes --disableplugin=subscription-manager --nodocs clean all && \
rm -rf /usr/lib/python3.6 && \
rm -rf /var/cache/yum

ENV VERSION 0.20.1
ENV VERSION 1.0.0
ENV JAR jmx_prometheus_httpserver-$VERSION.jar

COPY --from=javabuilder /opt/jmx_exporter/jmx_prometheus_httpserver/target/jmx_prometheus_httpserver-$VERSION-SNAPSHOT.jar /opt/jmx_exporter/$JAR
53 changes: 0 additions & 53 deletions build/Jenkinsfile

This file was deleted.

70 changes: 49 additions & 21 deletions collector/pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<parent>
<groupId>io.prometheus.jmx</groupId>
<artifactId>parent</artifactId>
<version>0.20.1-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>collector</artifactId>
@@ -24,14 +24,51 @@
</licenses>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<configuration>
<compilerArgument>-Xbootclasspath/a:${env.JAVA_HOME}/lib/</compilerArgument>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.config.file>src/test/resources/logging.properties</java.util.logging.config.file>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<artifactId>prometheus-metrics-core</artifactId>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>prometheus-metrics-model</artifactId>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>prometheus-metrics-exposition-formats</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -40,26 +77,17 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>prometheus-metrics-instrumentation-jvm</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>java.util.logging.config.file</name>
<value>src/test/resources/logging.properties</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</dependencies>

</project>
77 changes: 0 additions & 77 deletions collector/src/main/java/io/prometheus/jmx/BuildInfoCollector.java

This file was deleted.

70 changes: 70 additions & 0 deletions collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (C) 2018-2023 The Prometheus jmx_exporter Authors
*
* 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.
*/

package io.prometheus.jmx;

import io.prometheus.metrics.core.metrics.Info;
import io.prometheus.metrics.model.registry.PrometheusRegistry;

/**
* Collects jmx_exporter build version info.
*
* <p>Example usage:
*
* <pre>{@code
* new BuildInfoCollector()
* }</pre>
*
* Metrics being exported:
*
* <pre>
* jmx_exporter_build_info{version="3.2.0",name="jmx_prometheus_httpserver",} 1.0
* </pre>
*/
public class BuildInfoMetrics {

/**
* Method to register BuildInfoMetrics
*
* @return this BuildInfoMetrics
*/
public BuildInfoMetrics register() {
return register(PrometheusRegistry.defaultRegistry);
}

/**
* Method to register BuildInfoMetrics
*
* @param prometheusRegistry prometheusRegistry
* @return this BuildInfoMetrics
*/
public BuildInfoMetrics register(PrometheusRegistry prometheusRegistry) {
Info info =
Info.builder()
.name("jmx_exporter_build_info")
.help("JMX Exporter build information")
.labelNames("name", "version")
.register(prometheusRegistry);

Package pkg = this.getClass().getPackage();
String name = pkg.getImplementationTitle();
String version = pkg.getImplementationVersion();

info.setLabelValues(name != null ? name : "unknown", version != null ? version : "unknown");

return this;
}
}
Loading

0 comments on commit 7e5d66c

Please sign in to comment.