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.
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.
Famous databases with custom metrics: Oracle DB , Postgres , Oracle Coherence , MS SQL Server , IBM DB2
Examples of custom metric usages:
The APIs are supposed to be experimental.
package org.apache.ignite.metric; public interface IgniteMetrics extends Iterable<ReadOnlyMetricRegistry> { MetricRegistry customRegistry(String registryName); @Nullable ReadOnlyMetricRegistry findRegistry(String registryName); void removeCustomRegistry(String registryName); }
Names like "LongMetric" or "ObjectMetric" we already have in the package "org.apache.ignite.spi.metric".
package org.apache.ignite.metric; public interface MetricRegistry extends ReadOnlyMetricRegistry { IntMetric register(String name, IntSupplier supplier, @Nullable String desc); LongMetric register(String name, LongSupplier supplier, @Nullable String desc); DoubleMetric register(String name, DoubleSupplier supplier, @Nullable String desc); <T> ObjectMetric<T> register(String name, Supplier<T> supplier, Class<T> type, @Nullable String desc); BooleanMetric register(String name, BooleanSupplier supplier, @Nullable String desc); IntValueMetric intMetric(String name, @Nullable String desc); LongValueMetric longMetric(String name, @Nullable String desc); LongSumMetric longAdderMetric(String name, @Nullable String desc); DoubleValueMetric doubleMetric(String name, @Nullable String desc); <T> ObjectValueMetric<T> objectMetric(String name, Class<T> type, @Nullable String desc); void remove(String name); void reset(); }
package org.apache.ignite.metric; public interface ObjectValueMetric<T> extends ObjectMetric<T> { void value(T value); } public interface DoubleValueMetric extends DoubleMetric { void add(double value); void value(double value); } public interface LongSumMetric extends LongMetric { void add(long value); void increment(); void decrement(); } public interface LongValueMetric extends LongSumMetric { void value(long value); }
We already have implementations of more complex and useful metrics. We could also store custom metrics. Thus, the development stages might be:
Custom metric introduction | IGNITE-21156 |
---|