THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
...
...
...
...
...
...
...
...
...
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 IgniteCustomMetricsIgniteMetrics 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.
* Registry name is part of the full name until last '.'. Metric name is the last part of the full name.
*
* Full names and registry names of custom metrics are always prefixed with "custom.". For example, if provided fullregistry name is "a.b.c.mname",
* it is automatically converted to "custom.a.b.c.mname". If fullthe 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 IgniteCustomMetricsIgniteMetrics extends Iterable<ReadOnlyMetricRegistry> {
/**
<T extends* Metric>Adds Ta metric(String fullName, T metric);
void removeMetric(String fullName);
ReadOnlyMetricRegistry registry(String registryName);
void removeRegistry(String registryName);
// Essential metrics. Int, Long and Double should be enough. Return current or new metric.
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 fullNameregistryName, 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 fullNameregistryName, 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 fullNamemetricName, @Nullable String description);
// Might be useful the gauges. Return true if new metric is registered of false if metric is**
* 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 fullNamemetricName, LongSupplier valueSuppliersupplier, @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 fullNamemetricName, DoubleSupplier valueSuppliersupplier, @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 fullNamemetricName, BooleanSupplier valueSuppliersupplier, @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 |
---|