Page tree
Skip to end of metadata
Go to start of metadata

Overview

There are two types of metrics: TREND and COUNT. Trending metrics are typically monotonically increasing values used to derive metrics that define processing rates. Document and query counts are canonical examples of TREND type metrics. COUNT type metrics represent instantaneous values that are typically useful on the user's screen. CPU and node memory usage are canonical examples of COUNT metrics.

AIE treats custom metrics the same as standard metrics.

View incoming links.

Adding a metric source

MetricDefinitionSource

Creating a custom metric involves defining a bean that implements the MetricDefinitionSource interface. Whenever the performance server is detected (generally at system startup), AIE uses the beans implementing this interface to register metrics with the performance monitor. Because the performance server process can be restarted, this bean must support multiple callings.

/** Interface for code to implement if they are going to expose metrics for monitoring. */
public interface MetricDefinitionSource {

  /**Get all metrics available on this AIE node.  These metrics will be polled as specified and stored in the performance server.
   *  Some metrics may be provided by multiple AIE nodes.  */
  Map<MetricInstance, MetricValueSource> getAvailableMetrics() throws AttivioException;

  /** These metrics are not stored, but computed on demand
   * @return a list of derived metrics provided by this source */
  List<DerivedMetricDefinition> getDerivedMetrics();
}

Example implementation

Defining collected metrics

  @Override
  public Map<MetricInstance, MetricValueSource> getAvailableMetrics() throws AttivioException {
    Metric m = new Metric();
    m.setName("documents");
    m.setDescription("Total documents seen by the ingestion api.");
    m.setDesiredSampleInterval(5000);
    m.setSubsystem(Metric.SUBSYSTEM_INGESTION);
    m.setType(Type.TREND);
    m.setUnits("Documents");

    MetricInstance mi = new MetricInstance();
    mi.setMetric(m);
    mi.putDimension(MetricGuiHelper.InstanceDimension.nodeset.name(), EndpointUtils.getNodeName());
    mi.putDimension(MetricGuiHelper.InstanceDimension.hostname.name(), hostname);

    MetricValueSource mvs = new MetricValueSource() {
      @Override
      public double getValue() {
        return documentCount.get();
      }
    };
    return ObjectUtils.newMap(mi, mvs);
  }

Defining derived metrics

  public List<DerivedMetricDefinition> getDerivedMetrics() {
    return ObjectUtils.newList(
        new DerivedMetricDefinition("total documents", SumAcrossDimension.class.getName(),
            ObjectUtils.newMap(
                "sourceName", "documents",
                "dimension", MetricGuiHelper.InstanceDimension.nodeset.name())
        ),
        new DerivedMetricDefinition(MetricGuiHelper.MetricName.dps.name(), VelocityTrend.class.getName(),
            ObjectUtils.newMap(
                "sourceName", "total documents")
        ));
  }

Available Derived Metrics Classes

Class

Description

BinaryVelocityTrend

For example, average query latency

ConstantMetric

Defines a constant you can use to compute other metrics. For example, total physical RAM

Difference

For example,, physical RAM free

MaxAcrossDimension

For example, maximum host cpu %

PercentOf

For example, % disk used

PercentOfPeriod

For example, % time spent in GC

PercentRemaining

For example, % disk free

SumAcrossDimension

For example, total documents ingested

VelocityTrend

For example, dps

  • No labels