mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-30 01:53:09 +00:00
[AB-xx] improving scheduling interface
moving renaming module to int removing duplicated starboard feature validator sonar fixes
This commit is contained in:
15
abstracto-application/core/metrics-int/pom.xml
Normal file
15
abstracto-application/core/metrics-int/pom.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>core</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.core</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>metrics-int</artifactId>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,21 @@
|
||||
package dev.sheldan.abstracto.core.metrics.service;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode
|
||||
public class CounterMetric implements Metric {
|
||||
private String name;
|
||||
@Builder.Default
|
||||
private List<MetricTag> tagList = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.abstracto.core.metrics.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface Metric {
|
||||
String getName();
|
||||
void setName(String name);
|
||||
List<MetricTag> getTagList();
|
||||
void setTagList(List<MetricTag> tagList);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package dev.sheldan.abstracto.core.metrics.service;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.ToDoubleFunction;
|
||||
|
||||
public interface MetricService {
|
||||
void registerCounter(CounterMetric counterMetric, String help);
|
||||
void registerGauge(CounterMetric counterMetric, Supplier<Number> f, String help);
|
||||
void registerGauge(CounterMetric counterMetric, Supplier<Number> f, String help, String baseUnit);
|
||||
<T> void registerGauge(CounterMetric counterMetric, T obj, ToDoubleFunction<T> f, String help);
|
||||
<T> void registerGauge(CounterMetric counterMetric, T obj, ToDoubleFunction<T> f, String help, String baseUnit);
|
||||
void incrementCounter(CounterMetric name);
|
||||
void incrementCounter(CounterMetric name, Long amount);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package dev.sheldan.abstracto.core.metrics.service;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
public class MetricTag {
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
public static MetricTag getTag(String key, String value) {
|
||||
return MetricTag.builder().key(key).value(value).build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user