use of org.onlab.metrics.MetricsFeature in project onos by opennetworkinglab.
the class MetricsHelper method createTimer.
/**
* Creates a Timer instance with given name.
*
* @param component component name
* @param feature feature name
* @param name timer name
* @return Timer instance
*/
default Timer createTimer(String component, String feature, String name) {
final MetricsService metricsService = metricsService();
if (metricsService != null) {
MetricsComponent c = metricsService.registerComponent(component);
MetricsFeature f = c.registerFeature(feature);
return metricsService.createTimer(c, f, name);
}
return null;
}
use of org.onlab.metrics.MetricsFeature in project onos by opennetworkinglab.
the class SharedExecutorService method setMetricsService.
/**
* Enables or disables calculation of the pool performance metrics. If
* the metrics service is not null metric collection will be enabled;
* otherwise it will be disabled.
*
* @param metricsService optional metric service
*/
public void setMetricsService(MetricsService metricsService) {
if (this.metricsService == null && metricsService != null) {
// If metrics service was newly introduced, initialize metrics.
executorMetrics = metricsService.registerComponent("SharedExecutor");
MetricsFeature mf = executorMetrics.registerFeature("*");
queueMetrics = metricsService.createTimer(executorMetrics, mf, "Queue");
delayMetrics = metricsService.createTimer(executorMetrics, mf, "Delay");
} else if (this.metricsService != null && metricsService == null) {
// If the metrics service was newly withdrawn, tear-down metrics.
queueMetrics = null;
delayMetrics = null;
}
// Otherwise just record the metrics service
this.metricsService = metricsService;
}
use of org.onlab.metrics.MetricsFeature in project onos by opennetworkinglab.
the class SystemMetricsAggregator method getMeterMap.
private Map<ControlMetricType, Meter> getMeterMap(Set<ControlMetricType> types, MetricsComponent component, MetricsService service) {
Map<ControlMetricType, Meter> meterMap = Maps.newHashMap();
types.forEach(type -> {
MetricsFeature metricsFeature = component.registerFeature(type.toString());
Meter meter = service.createMeter(component, metricsFeature, DEFAULT_METER_SUFFIX);
meterMap.putIfAbsent(type, meter);
});
return meterMap;
}
Aggregations