Search in sources :

Example 1 with MetricsFeature

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;
}
Also used : MetricsService(org.onlab.metrics.MetricsService) MetricsFeature(org.onlab.metrics.MetricsFeature) MetricsComponent(org.onlab.metrics.MetricsComponent)

Example 2 with MetricsFeature

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;
}
Also used : MetricsFeature(org.onlab.metrics.MetricsFeature)

Example 3 with MetricsFeature

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;
}
Also used : ControlMetricType(org.onosproject.cpman.ControlMetricType) Meter(com.codahale.metrics.Meter) MetricsFeature(org.onlab.metrics.MetricsFeature)

Aggregations

MetricsFeature (org.onlab.metrics.MetricsFeature)3 Meter (com.codahale.metrics.Meter)1 MetricsComponent (org.onlab.metrics.MetricsComponent)1 MetricsService (org.onlab.metrics.MetricsService)1 ControlMetricType (org.onosproject.cpman.ControlMetricType)1