net.spy.memcached.metrics.MetricType Java Examples

The following examples show how to use net.spy.memcached.metrics.MetricType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MemcacheClientFactoryImplTest.java    From simple-spring-memcached with MIT License 6 votes vote down vote up
@Test
public void createWithSpecificConf() throws IOException {
    SpymemcachedConfiguration conf = new SpymemcachedConfiguration();
    conf.setConsistentHashing(true);
    conf.setOperationTimeout(1000);
    conf.setUseBinaryProtocol(false);
    conf.setFailureMode(FailureMode.Cancel);
    conf.setShouldOptimize(true);
    conf.setMaxReconnectDelay(1000L);
    conf.setTimeoutExceptionThreshold(100);
    conf.setUseNagleAlgorithm(false);
    conf.setMetricCollector(new NoopMetricCollector());
    conf.setMetricType(MetricType.PERFORMANCE);
    CacheClient client = factory.create(addrs, conf);
    assertNotNull(client);
    client.shutdown();
}
 
Example #2
Source File: MemcachedConnectionFactory.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
public MetricCollector getMetricCollector() {
    String enableMetrics = metricsConfig.get("memcached.enabled");
    if (enableMetrics().equals(MetricType.OFF) || enableMetrics == null
            || "false".equalsIgnoreCase(enableMetrics)) {
        getLogger().debug("Memcached metrics collection disabled.");
        return new NoopMetricCollector();
    } else {
        getLogger().info("Memcached metrics collection enabled (Profile " + enableMetrics() + ").");
        return new MemcachedMetrics();
    }
}
 
Example #3
Source File: MemcachedConnectionFactory.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public MetricCollector getMetricCollector() {
    String enableMetrics = metricsConfig.get("memcached.enabled");
    if (enableMetrics().equals(MetricType.OFF) || enableMetrics == null
            || "false".equalsIgnoreCase(enableMetrics)) {
        getLogger().debug("Memcached metrics collection disabled.");
        return new NoopMetricCollector();
    } else {
        getLogger().info("Memcached metrics collection enabled (Profile " + enableMetrics() + ").");
        return new MemcachedMetrics();
    }
}
 
Example #4
Source File: MemcachedConnectionFactory.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public MetricType enableMetrics() {
    String metricType = metricsConfig.get("memcached.metricstype");
    return metricType == null ? DefaultConnectionFactory.DEFAULT_METRIC_TYPE
            : MetricType.valueOf(metricType.toUpperCase(Locale.ROOT));
}
 
Example #5
Source File: MemcachedConnectionFactory.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public MetricType enableMetrics() {
    String metricType = metricsConfig.get("memcached.metricstype");
    return metricType == null ? DefaultConnectionFactory.DEFAULT_METRIC_TYPE
            : MetricType.valueOf(metricType.toUpperCase(Locale.ROOT));
}