Created
November 7, 2017 09:04
-
-
Save mwiede/30864cabac831ca25e528d35ec76cb69 to your computer and use it in GitHub Desktop.
example shjowing apache http client instrumentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MetricRegistry metricRegistry = new MetricRegistry(); | |
final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS) | |
.convertDurationsTo(TimeUnit.MILLISECONDS).build(); | |
GitHub github = Feign.builder().invocationHandlerFactory( | |
// instrument feign | |
new FeignOutboundMetricsDecorator(new InvocationHandlerFactory.Default(), metricRegistry)).client( | |
// setting an instrumented httpclient | |
new ApacheHttpClient(InstrumentedHttpClients | |
.createDefault(metricRegistry, HttpClientMetricNameStrategies.HOST_AND_METHOD))) | |
.decoder(new GsonDecoder()).target(GitHub.class, "https://api.github.com"); | |
execute... | |
reporter.report(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment