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

Compare with Current View Page History

« Previous Version 16 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

  • Aggregations, filtrations of the provided metrics.
  • 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 and a generic Metric.
  • 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 {

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

void longMetric(String name, LongSupplier valueSupplier, @Nullable String description);

LongConsumer longMetric(String name, @Nullable String description);

void doubleMetric(String name, DoubleSupplier valueSupplier, @Nullable String description);

DoubleConsumer doubleMetric(String name, @Nullable String description);

void booleanMetric(String name, BooleanSupplier valueSupplier, @Nullable String description);

Consumer<Boolean> booleanMetric(String name, @Nullable String description);

<T> void objectMetric(String name, Class<T> valueType, Supplier<T> valueSupplier, @Nullable String description);

<T> Consumer<T> objectMetric(String name, Class<T> valueType, @Nullable String description);

void removeMetric(String name);

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