Jagger
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
com.griddynamics.jagger.engine.e1.collector.MetricDescription Class Reference

Class to describe metric. More...

Inheritance diagram for com.griddynamics.jagger.engine.e1.collector.MetricDescription:

Public Member Functions

MetricDescription addAggregator (MetricAggregatorProvider aggregator)
 Append new aggregator to list of metric aggregator. More...
 
MetricDescription addAggregator (MetricAggregatorProvider aggregator, MetricAggregatorSettings settings)
 Append new aggregator to list of metric aggregator with settings. More...
 
MetricDescription displayName (String displayName)
 Setter for metric display name. More...
 
List< MetricAggregatorProvider > getAggregators ()
 Getter for metric aggregators. More...
 
Map< MetricAggregatorProvider,
MetricAggregatorSettings
getAggregatorsWithSettings ()
 Getter for metric aggregators with settings. More...
 
String getDisplayName ()
 Getter for metric display name. More...
 
String getMetricId ()
 Getter for metric ID. More...
 
boolean getPlotData ()
 Getter for metric "plot data" boolean parameter. More...
 
boolean getShowSummary ()
 Getter for metric "show summary" boolean parameter. More...
 
 MetricDescription (String metricId)
 Constructor. More...
 
MetricDescription plotData (boolean plotData)
 Setter for metric "plot data" boolean parameter. More...
 
void setAggregators (List< MetricAggregatorProvider > aggregators)
 Setter for metric aggregators. More...
 
void setAggregatorsWithSettings (Map< MetricAggregatorProvider, MetricAggregatorSettings > aggregatorsWithSettings)
 Setter for metric aggregators with settings. More...
 
void setDisplayName (String displayName)
 Setter for metric display name. More...
 
void setMetricId (String metricId)
 Setter for metric ID. More...
 
void setPlotData (boolean plotData)
 Setter for metric "plot data" boolean parameter. More...
 
void setShowSummary (boolean showSummary)
 Setter for metric "show summary" boolean parameter. More...
 
MetricDescription showSummary (boolean showSummary)
 Setter for metric "show summary" boolean parameter. More...
 

Protected Attributes

Map< MetricAggregatorProvider,
MetricAggregatorSettings
aggregatorsWithSettings = Maps.newHashMap()
 
String displayName
 
String id
 
boolean plotData
 
boolean showSummary = true
 

Detailed Description

Class to describe metric.

Author
Gribov Kirill

Example of metric setup and creation with use of metric service

package com.griddynamics.jagger.engine.e1.collector.invocation;
import com.griddynamics.jagger.engine.e1.Provider;
import com.griddynamics.jagger.engine.e1.collector.AvgMetricAggregatorProvider;
import com.griddynamics.jagger.engine.e1.collector.MaxMetricAggregatorProvider;
import com.griddynamics.jagger.engine.e1.collector.MetricDescription;
import com.griddynamics.jagger.engine.e1.collector.MinMetricAggregatorProvider;
import com.griddynamics.jagger.engine.e1.collector.PercentileAggregatorProvider;
import com.griddynamics.jagger.engine.e1.collector.invocation.InvocationInfo;
import com.griddynamics.jagger.engine.e1.collector.invocation.InvocationListener;
import com.griddynamics.jagger.engine.e1.services.ServicesAware;
import com.griddynamics.jagger.invoker.InvocationException;
public class ExampleInvocationListener extends ServicesAware implements Provider<InvocationListener> {
private final String metricName = "example-duration-metric";
@Override
protected void init() {
//begin: following section is used for docu generation - example of the metric with multiple aggregators
getMetricService().createMetric(new MetricDescription(metricName)
.displayName("Example duration metric, ms")
.showSummary(true)
.plotData(true)
.addAggregator(new MinMetricAggregatorProvider())
.addAggregator(new MaxMetricAggregatorProvider())
.addAggregator(new AvgMetricAggregatorProvider())
.addAggregator(new PercentileAggregatorProvider(40D))
.addAggregator(new PercentileAggregatorProvider(50D))
.addAggregator(new PercentileAggregatorProvider(60D))
.addAggregator(new PercentileAggregatorProvider(70D))
.addAggregator(new PercentileAggregatorProvider(80D))
.addAggregator(new PercentileAggregatorProvider(90D))
.addAggregator(new PercentileAggregatorProvider(95D))
.addAggregator(new PercentileAggregatorProvider(99D))
);
//end: following section is used for docu generation - example of the metric with multiple aggregators
}
@Override
public InvocationListener provide() {
return new InvocationListener() {
@Override
public void onStart(InvocationInfo invocationInfo) { }
@Override
public void onSuccess(InvocationInfo invocationInfo) {
if (invocationInfo.getResult() != null) {
getMetricService().saveValue(metricName, invocationInfo.getDuration());
}
}
@Override
public void onFail(InvocationInfo invocationInfo, InvocationException e) { }
@Override
public void onError(InvocationInfo invocationInfo, Throwable error) { }
};
}
}


Definition at line 17 of file MetricDescription.java.


The documentation for this class was generated from the following file: