You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

IDIEP-114
Author
Sponsor
Created
Status
DRAFT


Motivation

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.

Description

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.

Examples of custom metric usages

  • Some useful metrics may not be provided yet and user registers own.
  • Metrics for load balancing.
  • Various metrics of business processes or related to user application.
  • Security-related metrics.

Examples of databases with custom metrics

Oracle DBPostgresOracle CoherenceMS SQL ServerIBM DB2

Implementation proposal

General approach

  • Custom Metrics are based on the New Metric System.
  • Custom metric name begins with the prefix "custom.".
  • GridMetricManager handles the custom metrics.

  • We should provide ready-to-use simple metrics like LongMetric, DoubleMetric which is exported by existing metric exporters (JMX).
  • Custom metrics management requires a permission.
  • We should document examples of effecient metrics implementations like LongAdder.

API

   1. New metrics facade to Ignite:

package org.apache.ignite;

public interface Ignite {
   public IgniteMetrics metrics();

}

   2. New interface IgniteMetrics

package org.apache.ignite;

public interface IgniteMetrics {

      /** Registers generic custom metric. */

   <T extends Metric> T metric(T metric);

  /** Registers LongGauge. */
void longMetric(String name, LongSupplier valueSupplier, @Nullable String description);

  /** Registers LongMetric. */
LongConsumer longMetric(String name, @Nullable String description);

  /** Registers DoubleGauge. */
void doubleMetric(String name, DoubleSupplier valueSupplier, @Nullable String description);

  /** Registers DoubleMetric. */
DoubleConsumer doubleMetric(String name, @Nullable String description);

  /** Registers BooleanGauge. */
void booleanMetric(String name, BooleanSupplier valueSupplier, @Nullable String description);

  /** Registers BooleanMetric. */
Consumer<Boolean> booleanMetric(String name, @Nullable String description);

  /** Registers ObjectGauge. */
<T> void objectMetric(String name, Class<T> valueType, Supplier<T> valueSupplier, @Nullable String description);

  /** Registers ObjectMetric. */
<T> Consumer<T> objectMetric(String name, Class<T> valueType, @Nullable String description);

  /** Removes custom metric. */
void removeMetric(String name);

  /** @return custom Metric registry. */
ReadOnlyMetricRegistry registry(String name);
}

Risks and Assumptions

    Custom metrics can affect the performance.

Phases

  1. Implementation of the described API.
  2. Extending the API with metrics like Histogram, HitRate. Allowing to configure metrics.
  3. Storing registered custom metrics with their configurations.

Discussion Links

Tickets


  • No labels