Created
November 7, 2017 09:01
-
-
Save mwiede/a3f530d2e3c5439ae610928b2e83a2d8 to your computer and use it in GitHub Desktop.
example showing how to instrument ok http client
This file contains 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( | |
// instrumenting feign | |
new FeignOutboundMetricsDecorator(new InvocationHandlerFactory.Default(), metricRegistry)) | |
// instrumenting ok http | |
.client(new OkHttpClient(InstrumentedOkHttpClients.create(metricRegistry))) | |
.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