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.
Oracle DB , Postgres , Oracle Coherence , MS SQL Server , IBM DB2
An API to expose internals read-noly metrics was already proposed. Might be joined with the custom metrics.
To give an user the ability to register additional metrics, we could either:
These two approaches are shown below.
package org.apache.ignite;
public interface Ignite {
public IgniteMetrics metrics();
}
package org.apache.ignite;
/**
* Manages custom metrics. Provides read-only internal metrics.
*
* Metrics are grouped into registries. Every metric has full name which is the conjunction of registry name and metric name.
*
* Full names and registry names of custom metrics are always prefixed with "custom.". For example, if provided registry name is "a.b.c.mname",
* it is automatically converted to "custom.a.b.c.mname". If the name is "custom.a.b.c.mname", it is used as is.
* Where "custom.a.b.c" is a registry name and "mname" is a metric name.
*/
@IgniteExperimental
public interface IgniteMetrics extends Iterable<ReadOnlyMetricRegistry> {
/**
* Adds a long value custom metric.
*
* @return New or previously registered long value metric. {@code Null} if previous metric is not a {@link LongConsumer}.
*/
@Nullable LongConsumer longMetric(String registryName, String metricName, @Nullable String description);
/**
* Adds a double value custom metric.
*
* @return New or previously registered long value metric. {@code Null} if previous metric is not a {@link DoubleConsumer}.
*/
@Nullable DoubleConsumer doubleMetric(String registryName, String metricName, @Nullable String description);
/**
* Adds a int value custom metric.
*
* @return New or previously registered long value metric. {@code Null} if previous metric is not an {@link IntConsumer}.
*/
@Nullable IntConsumer booleanMetric(String registryName, String metricName, @Nullable String description);
/**
* Adds a long value custom metric.
*
* @return {@code True} if {@code supplier} has been registered as a new int metric. {@code False}, if a previous
* value supplier already exists.
*/
boolean longMetric(String registryName, String metricName, LongSupplier supplier, @Nullable String description);
/**
* Adds a double value custom metric.
*
* @return {@code True} if {@code supplier} has been registered as a new int metric. {@code False}, if a previous
* value supplier already exists.
*/
boolean doubleMetric(String registryName, String metricName, DoubleSupplier supplier, @Nullable String description);
/**
* Adds a int value custom metric.
*
* @return {@code True} if {@code supplier} has been registered as a new int metric. {@code False}, if a previous
* value supplier already exists.
*/
boolean intMetric(String registryName, String metricName, BooleanSupplier supplier, @Nullable String description);
/** Removes certain custom metric. */
void removeCustomMetric(String registryName, String metricName);
/** Removes entire custom metric registry. */
void removeCustomRegistry(String registryName);
/** Provides custom or internal read-only metric registry. */
@Nullable ReadOnlyMetricRegistry findRegistry(String registryName);
}
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 |
---|