Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

IDIEP-114
Author
Sponsor
Created
Status
Status
colourGrey
titleDRAFT

...

/**
* Custom metric manager. Allows to add own metrics in registers with names starting with "custom.".
*/
public interface IgniteMetrics {
/**
* Registers metric in register 'custom.' + {@code registryName}. Adds new register if absent.
*
* @return New {@code metric} if absent. Previousor previous metric if it already exists with the same name.
*/
<T extends Metric> T metric(String registryName, T metric);

/** Removes metric from register 'custom.' + {@code registryName}. */
void removeMetric(String registryName, String metricName);

/** @return Metric registry named '"custom." + {@code registryName}'. */
ReadOnlyMetricRegistry registry(String registryName);

/** @return Removes registry named '"custom." + {@code registryName}'. */
ReadOnlyMetricRegistry removeRegistry(String registryName);


// Simple type metrics.

/**
* Registers {@link LongMetric} in register 'custom.' + {@code registryName}. Adds register if absent.
*
* @return New or previouspreviously registered long value setter.
*/
LongConsumer longMetric(String registryName, String metricName, @Nullable String description);

/**
* Registers a {@link DoubleMetric} in register 'custom.' + {@code registryName}. Adds register if absent.
*
* @return New or previously previousregistered double value setter.
*/
DoubleConsumer doubleMetric(String registryName, String metricName, @Nullable String description);

/**
* Registers a {@link BooleanMetric} in register 'custom.' + {@code registryName}. Adds register if absent.
*
* @return New or previouspreviously registered boolean value setter.
*/
Consumer<Boolean> booleanMetric(String registryName, String metricName, @Nullable String description);

/**
* Registers a {@link ObjectMetric} in register 'custom.' + {@code registryName}. Adds register if absent.
*
* @return New or previouspreviously registered object setter.
*/
<T> Consumer<T> objectMetric(String registryName, String metricName, Class<T> valueType, @Nullable String description);


// Might be useful the gauges:

/**
* Registers a {@link LongMetric} metric in register 'custom.' + {@code registryName} with long value supplier {@code valueSupplier}.
* Adds register if absent.
*
* @return {@code True} if metric was added. {@code False} if another meric already exists under the same name.
*/
boolean longMetric(String registryName, String metricName, LongSupplier valueSupplier, @Nullable String description);

/**
* Registers a {@link DoubleMetric} metric in register 'custom.' + {@code registryName} with double value supplier {@code valueSupplier}.
* Adds register if absent.
*
* @return {@code True} if metric was added. {@code False} if another meric already exists under the same name.
*/
boolean doubleMetric(String registryName, String metricName, DoubleSupplier valueSupplier, @Nullable String description);

/**
* Registers a {@link BooleanMetric} metric in register 'custom.' + {@code registryName} with boolean value supplier {@code valueSupplier}.
* Adds register if absent.
*
* @return {@code True} if metric was added. {@code False} if another meric already exists under the same name.
*/
boolean booleanMetric(String registryName, String metricName, BooleanSupplier valueSupplier, @Nullable String description);

/**
* Registers a {@link ObjectMetric} metric in register 'custom.' + {@code registryName} with object value supplier {@code valueSupplier}.
* Adds register if absent.
*
* @return {@code True} if metric was added. {@code False} if another meric already exists under the same name.
*/
<T> boolean objectMetric(String registryName, String metricName, Class<T> valueType, Supplier<T> valueSupplier, @Nullable String description);
}

...