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

[AMORO-2797] Improve ams metrics module naming #2798

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>amoro-ams-metric-reporter</artifactId>
<artifactId>amoro-ams-metrics</artifactId>
<groupId>org.apache.amoro</groupId>
<version>0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>prometheus-reporter</artifactId>
<artifactId>amoro-metrics-prometheus</artifactId>
<name>Amoro Project AMS Prometheus Reporter</name>
<url>https://amoro.apache.org</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.amoro.metrics.reporter.promethues;
package org.apache.amoro.metrics.promethues;

import io.prometheus.client.Collector;
import org.apache.amoro.api.metrics.Counter;
Expand All @@ -37,14 +37,14 @@
import java.util.stream.Collectors;

/** Metric type converter for prometheus api */
public class MetricCollector extends Collector {
private static final Logger LOGGER = LoggerFactory.getLogger(MetricCollector.class);
public class MetricsCollector extends Collector {
private static final Logger LOGGER = LoggerFactory.getLogger(MetricsCollector.class);
private static final String PREFIX = "amoro_";
private static final Pattern NAME_PATTERN = Pattern.compile("[a-zA-Z_:][a-zA-Z0-9_:]*");
private static final Pattern LABEL_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_]*");
MetricSet metrics;

public MetricCollector(MetricSet metrics) {
public MetricsCollector(MetricSet metrics) {
this.metrics = metrics;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package org.apache.amoro.metrics.reporter.promethues;
package org.apache.amoro.metrics.promethues;

import io.prometheus.client.exporter.HTTPServer;
import org.apache.amoro.api.metrics.MetricReporter;
Expand All @@ -27,22 +27,21 @@
import java.util.Optional;

/** Prometheus exporter */
public class PrometheusExporterMetricReporter implements MetricReporter {
public class PrometheusMetricsReporter implements MetricReporter {

public static final String PORT = "port";

private int port;
private HTTPServer server;

@Override
public void open(Map<String, String> properties) {
this.port =
int port =
Optional.ofNullable(properties.get(PORT))
.map(Integer::valueOf)
.orElseThrow(() -> new IllegalArgumentException("Lack required property: " + PORT));

try {
this.server = new HTTPServer(this.port);
this.server = new HTTPServer(port);
} catch (IOException e) {
throw new RuntimeException("Start prometheus exporter server failed.", e);
}
Expand All @@ -60,7 +59,7 @@ public String name() {

@Override
public void setGlobalMetricSet(MetricSet globalMetricSet) {
MetricCollector collector = new MetricCollector(globalMetricSet);
MetricsCollector collector = new MetricsCollector(globalMetricSet);
collector.register();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
<version>0.7-SNAPSHOT</version>
</parent>

<artifactId>amoro-ams-metric-reporter</artifactId>
<artifactId>amoro-ams-metrics</artifactId>
<packaging>pom</packaging>
<name>Amoro Project AMS Metric Reporter Parent</name>
<url>https://amoro.apache.org</url>

<modules>
<module>prometheus-reporter</module>
<module>amoro-metrics-prometheus</module>
</modules>

</project>
2 changes: 1 addition & 1 deletion amoro-ams/dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</dependency>
<dependency>
<groupId>org.apache.amoro</groupId>
<artifactId>prometheus-reporter</artifactId>
<artifactId>amoro-metrics-prometheus</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion amoro-ams/dist/src/main/assemblies/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</file>
<file>
<source>
../amoro-ams-metric-reporter/prometheus-reporter/target/prometheus-reporter-${project.version}-jar-with-dependencies.jar
../amoro-ams-metrics/amoro-metrics-prometheus/target/amoro-metrics-prometheus-${project.version}-jar-with-dependencies.jar
</source>
<outputDirectory>plugin/metrics-reporter</outputDirectory>
<destName>prometheus-reporter.jar</destName>
Expand Down
2 changes: 1 addition & 1 deletion amoro-ams/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<module>amoro-ams-server</module>
<module>amoro-ams-dashboard</module>
<module>amoro-ams-optimizer</module>
<module>amoro-ams-metric-reporter</module>
<module>amoro-ams-metrics</module>
<module>dist</module>
</modules>

Expand Down