A API to record application's metrics data for vrml library
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>vrml-metric</artifactId>
<version>1.1.4</version>
</dependency>
- Metric code and main process isolation
- Support dynamic configuration of multiple levels
- Provide easy-to-use API tools
- Isolation of each exception
- Support dynamic configuration of multiple levels
- Support shard embedding metric point based on
ThreadLocal
- Support complex expression evaluation
The Metric API provides a series of methods to record application's metrics data.
/**
* API demo show
*/
private static void metrics(BiConsumer<Map<String, String>, Map<String, String>> howToShow) {
// Option 1: add metric manually
Metrics.metric(() -> {
// index
index(MetricIndexs.metric_type, "index");
// store
store(MetricStores.context, "store");
// exception
exception(new RuntimeException());
// object
object(new Object());
});
howToShow.accept(Metrics.showIndexs(), Metrics.showStores());
Metrics.build();
// Option 2: add metric by automatic placeholder "$"
Metrics.Log().of(
// index
$(MetricIndexs.metric_type, "index"),
// store
$(MetricStores.context, "store"),
// exception
$(new RuntimeException()),
// object
$(new Object())
);
howToShow.accept(Metrics.showIndexs(), Metrics.showStores());
Metrics.build();
// Also you can use {@code local()} to start a local scope
String local = Metrics.local();
Metrics.Log(local).of(
// Also you can use supplier
() -> $(MetricIndexs.metric_type, "index"),
() -> $(MetricStores.context, "store"),
() -> $(new RuntimeException()),
() -> $(new Object())
);
howToShow.accept(Metrics.showIndexs(), Metrics.showStores());
Metrics.build(local);
}
Developer repository can be found here.
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>vrml-metrics</artifactId>
<version>1.1.4</version>
</dependency>
A small number of users have reported problems building vrml. Read our contribution guide for details.