ID | IEP-114 |
Author | |
Sponsor | |
Created | |
Status | DRAFT |
It is useful for user to work with own metrics, not only with provided by Ignite. Current public metrics API doesn't expose any method to add or delete additional metrics. We should allow user to register custom metrics.
The most important reason to provide custom is probably the convenience of collecting of desired metrics using one platform, the same client, through the same API. This feature can simplify user application.
Oracle DB , Postgres , Oracle Coherence , MS SQL Server , IBM DB2
GridMetricManager handles custom metrics.
package org.apache.ignite;
public interface Ignite {
public IgniteMetrics metrics();
}
package org.apache.ignite;
public interface IgniteMetrics {
/** Registers generic custom metric. */
<T extends Metric> T metric(T metric);
/** Removes custom metric named '"custom." + {@code name}'. */
void removeMetric(String name);
/** @return custom Metric registry named '"custom." + {@code name}'. */
ReadOnlyMetricRegistry registry(String name);
// Simple type metrics.
/** Registers LongMetric. */
LongConsumer longMetric(String name, @Nullable String description);
/** Registers DoubleMetric. */
DoubleConsumer doubleMetric(String name, @Nullable String description);
/** Registers BooleanMetric. */
Consumer<Boolean> booleanMetric(String name, @Nullable String description);
/** Registers ObjectMetric. */
<T> Consumer<T> objectMetric(String name, Class<T> valueType, @Nullable String description);
// Might be useful the gauges:
/** Registers DoubleGauge. */
void doubleMetric(String name, DoubleSupplier valueSupplier, @Nullable String description);
/** Registers BooleanGauge. */
void booleanMetric(String name, BooleanSupplier valueSupplier, @Nullable String description);
/** Registers ObjectGauge. */
<T> void objectMetric(String name, Class<T> valueType, Supplier<T> valueSupplier, @Nullable String description);
/** Registers LongGauge. */
void longMetric(String name, LongSupplier valueSupplier, @Nullable String description);
}
Custom metrics can affect the performance.