Search in sources :

Example 1 with ExceptionsMetric

use of com.netflix.discovery.util.ExceptionsMetric in project eureka by Netflix.

the class MetricsCollectingEurekaHttpClient method createFactory.

public static TransportClientFactory createFactory(final TransportClientFactory delegateFactory) {
    final Map<RequestType, EurekaHttpClientRequestMetrics> metricsByRequestType = initializeMetrics();
    final ExceptionsMetric exceptionMetrics = new ExceptionsMetric(EurekaClientNames.METRIC_TRANSPORT_PREFIX + "exceptions");
    return new TransportClientFactory() {

        @Override
        public EurekaHttpClient newClient(EurekaEndpoint endpoint) {
            return new MetricsCollectingEurekaHttpClient(delegateFactory.newClient(endpoint), metricsByRequestType, exceptionMetrics, false);
        }

        @Override
        public void shutdown() {
            shutdownMetrics(metricsByRequestType);
            exceptionMetrics.shutdown();
        }
    };
}
Also used : ExceptionsMetric(com.netflix.discovery.util.ExceptionsMetric) TransportClientFactory(com.netflix.discovery.shared.transport.TransportClientFactory) EurekaEndpoint(com.netflix.discovery.shared.resolver.EurekaEndpoint)

Example 2 with ExceptionsMetric

use of com.netflix.discovery.util.ExceptionsMetric in project eureka by Netflix.

the class MetricsCollectingEurekaHttpClient method createFactory.

public static EurekaHttpClientFactory createFactory(final EurekaHttpClientFactory delegateFactory) {
    final Map<RequestType, EurekaHttpClientRequestMetrics> metricsByRequestType = initializeMetrics();
    final ExceptionsMetric exceptionMetrics = new ExceptionsMetric(EurekaClientNames.METRIC_TRANSPORT_PREFIX + "exceptions");
    return new EurekaHttpClientFactory() {

        @Override
        public EurekaHttpClient newClient() {
            return new MetricsCollectingEurekaHttpClient(delegateFactory.newClient(), metricsByRequestType, exceptionMetrics, false);
        }

        @Override
        public void shutdown() {
            shutdownMetrics(metricsByRequestType);
            exceptionMetrics.shutdown();
        }
    };
}
Also used : EurekaHttpClientFactory(com.netflix.discovery.shared.transport.EurekaHttpClientFactory) ExceptionsMetric(com.netflix.discovery.util.ExceptionsMetric)

Aggregations

ExceptionsMetric (com.netflix.discovery.util.ExceptionsMetric)2 EurekaEndpoint (com.netflix.discovery.shared.resolver.EurekaEndpoint)1 EurekaHttpClientFactory (com.netflix.discovery.shared.transport.EurekaHttpClientFactory)1 TransportClientFactory (com.netflix.discovery.shared.transport.TransportClientFactory)1