use of com.yahoo.athenz.common.metrics.MetricFactory in project athenz by yahoo.
the class MetricNotificationServiceFactory method loadMetricObject.
Metric loadMetricObject() {
String metricFactoryClass = System.getProperty(NOTIFICATION_PROP_METRIC_FACTORY_CLASS, METRIC_DEFAULT_FACTORY_CLASS);
MetricFactory metricFactory;
try {
metricFactory = (MetricFactory) Class.forName(metricFactoryClass).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
LOG.error("Invalid MetricFactory class: {} error: {}", metricFactoryClass, e.getMessage());
throw new IllegalArgumentException("Invalid metric class");
}
LOG.info("Loaded MetricFactory for receiving notification metrics: {}", metricFactoryClass);
// create our metric
return metricFactory.create();
}
use of com.yahoo.athenz.common.metrics.MetricFactory in project athenz by yahoo.
the class JettyConnectionLoggerFactory method getMetric.
private static Metric getMetric() {
final String metricFactoryClass = System.getProperty(JETTY_PROP_METRIC_FACTORY_CLASS, METRIC_DEFAULT_FACTORY_CLASS);
MetricFactory metricFactory;
try {
metricFactory = (MetricFactory) Class.forName(metricFactoryClass).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
LOG.error("Invalid MetricFactory class: {} error: {}", metricFactoryClass, e.getMessage());
throw new IllegalArgumentException("Invalid metric class");
}
return metricFactory.create();
}
use of com.yahoo.athenz.common.metrics.MetricFactory in project athenz by yahoo.
the class MetricsTest method testFactoryNoOpMetric.
@Test
public void testFactoryNoOpMetric() throws Exception {
MetricFactory factory = new NoOpMetricFactory();
Metric metric = factory.create();
assertEquals(metric.getClass().getName(), Class.forName("com.yahoo.athenz.common.metrics.impl.NoOpMetric").getName());
metric.increment("metric1");
metric.increment("metric1", "athenz");
metric.increment("metric1", "athenz", 3);
metric.increment("metric1", "athenz", "sports");
metric.increment("metric1", "athenz", "sports", 3);
metric.increment("apiRquestsMetric", "athenz", "sports", "POST", 200, "caller");
String[] attributes = new String[] { "tag1", "value1", "tag2", "value2", "tag3", "value3" };
metric.increment("metric1", attributes);
assertNull(metric.startTiming("metric1", "athenz"));
assertNull(metric.startTiming("metric1", "athenz", "sports"));
assertNull(metric.startTiming("apiRquestsMetric", "athenz", "sports", "POST", "caller"));
metric.stopTiming("metric1");
metric.stopTiming("metric1", "athenz", "sports");
metric.stopTiming("apiRquestsMetric", "athenz", "sports", "POST", 200, "caller");
metric.flush();
metric.quit();
}
use of com.yahoo.athenz.common.metrics.MetricFactory in project athenz by yahoo.
the class ZTSImpl method loadMetricObject.
void loadMetricObject() {
final String metricFactoryClass = System.getProperty(ZTSConsts.ZTS_PROP_METRIC_FACTORY_CLASS, METRIC_DEFAULT_FACTORY_CLASS);
MetricFactory metricFactory;
try {
metricFactory = (MetricFactory) Class.forName(metricFactoryClass).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
LOGGER.error("Invalid MetricFactory class: {} error: {}", metricFactoryClass, e.getMessage());
throw new IllegalArgumentException("Invalid metric class");
}
// create our metric and increment our startup count
metric = metricFactory.create();
metric.increment("zts_startup");
}
use of com.yahoo.athenz.common.metrics.MetricFactory in project athenz by yahoo.
the class ZMSImpl method loadMetricObject.
void loadMetricObject() {
String metricFactoryClass = System.getProperty(ZMSConsts.ZMS_PROP_METRIC_FACTORY_CLASS, METRIC_DEFAULT_FACTORY_CLASS);
MetricFactory metricFactory;
try {
metricFactory = (MetricFactory) Class.forName(metricFactoryClass).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
LOG.error("Invalid MetricFactory class: {} error: {}", metricFactoryClass, e.getMessage());
throw new IllegalArgumentException("Invalid metric class");
}
// create our metric and increment our startup count
ZMSImpl.metric = metricFactory.create();
metric.increment("zms_sa_startup");
}
Aggregations