{"id":74,"date":"2017-10-29T13:46:09","date_gmt":"2017-10-29T13:46:09","guid":{"rendered":"http:\/\/www.matez.de\/?p=74"},"modified":"2017-11-07T10:09:08","modified_gmt":"2017-11-07T10:09:08","slug":"feign-outbound-metrics","status":"publish","type":"post","link":"https:\/\/www.matez.de\/index.php\/2017\/10\/29\/feign-outbound-metrics\/","title":{"rendered":"Feign Outbound metrics\u00a0"},"content":{"rendered":"<p>With dropwizard microservices, you can easily add <strong>inbound metrics<\/strong> on your <a href=\"http:\/\/metrics.dropwizard.io\/3.1.0\/manual\/jersey\/#instrumenting-jersey-2-x\">jax-rs http resource classes via annotations<\/a>:<\/p>\n<div id=\"gist82800498\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-exampleresource-java\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-java  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"ExampleResource.java content, created by mwiede on 09:16AM on November 07, 2017.\">\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      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.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"%7B%7B%20revealButtonHref%20%7D%7D\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"ExampleResource.java\">\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-exampleresource-java-LC1\" class=\"blob-code blob-code-inner js-file-line\">@Path(\"\/example\")<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-exampleresource-java-LC2\" class=\"blob-code blob-code-inner js-file-line\">@Produces(MediaType.TEXT_PLAIN)<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-exampleresource-java-LC3\" class=\"blob-code blob-code-inner js-file-line\">public class ExampleResource {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-exampleresource-java-LC4\" class=\"blob-code blob-code-inner js-file-line\">    @GET<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-exampleresource-java-LC5\" class=\"blob-code blob-code-inner js-file-line\">    @Timed<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-exampleresource-java-LC6\" class=\"blob-code blob-code-inner js-file-line\">    @Metered<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-exampleresource-java-LC7\" class=\"blob-code blob-code-inner js-file-line\">    @ExceptionMetered<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-exampleresource-java-LC8\" class=\"blob-code blob-code-inner js-file-line\">    public String show() {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-exampleresource-java-LC9\" class=\"blob-code blob-code-inner js-file-line\">        return \"yay\";<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-exampleresource-java-LC10\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-exampleresource-java-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-exampleresource-java-LC11\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/mwiede\/b6b0e90f70b6ea0d744ddb7f46a64b90\/raw\/0bb7dc4a103c3333ae6f72df4d9ad81c42e2cec1\/ExampleResource.java\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/b6b0e90f70b6ea0d744ddb7f46a64b90#file-exampleresource-java\" class=\"Link--inTextBlock\">\n          ExampleResource.java\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p>The metrics can easily been reported to graphite database and visualized via Kibana.<\/p>\n<h3>WYIIWYG &#8211; What you instrument, is what you get!<\/h3>\n<p>On the other hand, a microservice often contains client libraries to access other services via http. Feign is client library, which provides a wrapper and simplifies the api to communicate to the target services.<\/p>\n<p>In contrast to the inbound metrics from the example above, it is also desirable to monitor the <strong>outbound metrics<\/strong> of each of the targeted operations.<\/p>\n<p>Looking at the third-party libraries of\u00a0<a href=\"http:\/\/metrics.dropwizard.io\/3.2.3\/manual\/third-party.html\">http:\/\/metrics.dropwizard.io\/3.2.3\/manual\/third-party.html<\/a> there is already something to retrieve metrics on http level. So in case you are using okhttp as http client implementation you can use\u00a0<a href=\"https:\/\/github.com\/raskasa\/metrics-okhttp\">https:\/\/github.com\/raskasa\/metrics-okhttp<\/a> and you will receive information about request durations and connection pools.\u00a0 Same holds good for Apache httpclient instrumentation.<\/p>\n<h3>okhttp example<\/h3>\n<div id=\"gist82800171\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-okhttpexample-java\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-java  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"OkHttpExample.java content, created by mwiede on 09:01AM on November 07, 2017.\">\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      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.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"%7B%7B%20revealButtonHref%20%7D%7D\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"OkHttpExample.java\">\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-okhttpexample-java-LC1\" class=\"blob-code blob-code-inner js-file-line\">  MetricRegistry metricRegistry = new MetricRegistry();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-okhttpexample-java-LC2\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-okhttpexample-java-LC3\" class=\"blob-code blob-code-inner js-file-line\">  final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-okhttpexample-java-LC4\" class=\"blob-code blob-code-inner js-file-line\">          .convertDurationsTo(TimeUnit.MILLISECONDS).build();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-okhttpexample-java-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-okhttpexample-java-LC6\" class=\"blob-code blob-code-inner js-file-line\">  GitHub github = Feign.builder().invocationHandlerFactory(<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-okhttpexample-java-LC7\" class=\"blob-code blob-code-inner js-file-line\">          \/\/ instrumenting feign<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-okhttpexample-java-LC8\" class=\"blob-code blob-code-inner js-file-line\">          new FeignOutboundMetricsDecorator(new InvocationHandlerFactory.Default(), metricRegistry))<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-okhttpexample-java-LC9\" class=\"blob-code blob-code-inner js-file-line\">          \/\/ instrumenting ok http<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-okhttpexample-java-LC10\" class=\"blob-code blob-code-inner js-file-line\">          .client(new OkHttpClient(InstrumentedOkHttpClients.create(metricRegistry)))          <\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-okhttpexample-java-LC11\" class=\"blob-code blob-code-inner js-file-line\">          .decoder(new GsonDecoder()).target(GitHub.class, \"https:\/\/api.github.com\");<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-okhttpexample-java-LC12\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-okhttpexample-java-LC13\" class=\"blob-code blob-code-inner js-file-line\">  execute...<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-okhttpexample-java-LC14\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-okhttpexample-java-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-okhttpexample-java-LC15\" class=\"blob-code blob-code-inner js-file-line\">  reporter.report();<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/mwiede\/a3f530d2e3c5439ae610928b2e83a2d8\/raw\/6915f66f518f536e75371b675ac6eed87b14a460\/OkHttpExample.java\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/a3f530d2e3c5439ae610928b2e83a2d8#file-okhttpexample-java\" class=\"Link--inTextBlock\">\n          OkHttpExample.java\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p>Metric output:<\/p>\n<div id=\"gist82800337\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-gistfile1-txt\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-text  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"gistfile1.txt content, created by mwiede on 09:08AM on November 07, 2017.\">\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      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.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"%7B%7B%20revealButtonHref%20%7D%7D\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"gistfile1.txt\">\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-gistfile1-txt-LC1\" class=\"blob-code blob-code-inner js-file-line\">-- Gauges ----------------------------------------------------------------------<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-gistfile1-txt-LC2\" class=\"blob-code blob-code-inner js-file-line\">okhttp3.OkHttpClient.connection-pool-idle-count<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-gistfile1-txt-LC3\" class=\"blob-code blob-code-inner js-file-line\">             value = 1<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-gistfile1-txt-LC4\" class=\"blob-code blob-code-inner js-file-line\">okhttp3.OkHttpClient.connection-pool-total-count<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-gistfile1-txt-LC5\" class=\"blob-code blob-code-inner js-file-line\">             value = 1<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-gistfile1-txt-LC6\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-gistfile1-txt-LC7\" class=\"blob-code blob-code-inner js-file-line\">-- Counters --------------------------------------------------------------------<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-gistfile1-txt-LC8\" class=\"blob-code blob-code-inner js-file-line\">okhttp3.OkHttpClient.network-requests-running<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-gistfile1-txt-LC9\" class=\"blob-code blob-code-inner js-file-line\">             count = 0<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-gistfile1-txt-LC10\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-gistfile1-txt-LC11\" class=\"blob-code blob-code-inner js-file-line\">-- Meters ----------------------------------------------------------------------<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-gistfile1-txt-LC12\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-gistfile1-txt-LC13\" class=\"blob-code blob-code-inner js-file-line\">okhttp3.OkHttpClient.network-requests-completed<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-gistfile1-txt-LC14\" class=\"blob-code blob-code-inner js-file-line\">             count = 1<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-gistfile1-txt-LC15\" class=\"blob-code blob-code-inner js-file-line\">         mean rate = 0,84 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-gistfile1-txt-LC16\" class=\"blob-code blob-code-inner js-file-line\">     1-minute rate = 0,00 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-gistfile1-txt-LC17\" class=\"blob-code blob-code-inner js-file-line\">     5-minute rate = 0,00 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-gistfile1-txt-LC18\" class=\"blob-code blob-code-inner js-file-line\">    15-minute rate = 0,00 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-gistfile1-txt-LC19\" class=\"blob-code blob-code-inner js-file-line\">okhttp3.OkHttpClient.network-requests-submitted<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-gistfile1-txt-LC20\" class=\"blob-code blob-code-inner js-file-line\">             count = 1<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-gistfile1-txt-LC21\" class=\"blob-code blob-code-inner js-file-line\">         mean rate = 0,83 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-gistfile1-txt-LC22\" class=\"blob-code blob-code-inner js-file-line\">     1-minute rate = 0,00 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-gistfile1-txt-LC23\" class=\"blob-code blob-code-inner js-file-line\">     5-minute rate = 0,00 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-gistfile1-txt-LC24\" class=\"blob-code blob-code-inner js-file-line\">    15-minute rate = 0,00 events\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-gistfile1-txt-LC25\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-gistfile1-txt-LC26\" class=\"blob-code blob-code-inner js-file-line\">-- Timers ----------------------------------------------------------------------<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-gistfile1-txt-LC27\" class=\"blob-code blob-code-inner js-file-line\">okhttp3.OkHttpClient.network-requests-duration<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-gistfile1-txt-LC28\" class=\"blob-code blob-code-inner js-file-line\">             count = 1<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-gistfile1-txt-LC29\" class=\"blob-code blob-code-inner js-file-line\">         mean rate = 0,84 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-gistfile1-txt-LC30\" class=\"blob-code blob-code-inner js-file-line\">     1-minute rate = 0,00 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-gistfile1-txt-LC31\" class=\"blob-code blob-code-inner js-file-line\">     5-minute rate = 0,00 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-gistfile1-txt-LC32\" class=\"blob-code blob-code-inner js-file-line\">    15-minute rate = 0,00 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-gistfile1-txt-LC33\" class=\"blob-code blob-code-inner js-file-line\">               min = 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-gistfile1-txt-LC34\" class=\"blob-code blob-code-inner js-file-line\">               max = 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-gistfile1-txt-LC35\" class=\"blob-code blob-code-inner js-file-line\">              mean = 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L36\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"36\"><\/td>\n          <td id=\"file-gistfile1-txt-LC36\" class=\"blob-code blob-code-inner js-file-line\">            stddev = 0,00 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L37\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"37\"><\/td>\n          <td id=\"file-gistfile1-txt-LC37\" class=\"blob-code blob-code-inner js-file-line\">            median = 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L38\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"38\"><\/td>\n          <td id=\"file-gistfile1-txt-LC38\" class=\"blob-code blob-code-inner js-file-line\">              75% &lt;= 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L39\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"39\"><\/td>\n          <td id=\"file-gistfile1-txt-LC39\" class=\"blob-code blob-code-inner js-file-line\">              95% &lt;= 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L40\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"40\"><\/td>\n          <td id=\"file-gistfile1-txt-LC40\" class=\"blob-code blob-code-inner js-file-line\">              98% &lt;= 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L41\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"41\"><\/td>\n          <td id=\"file-gistfile1-txt-LC41\" class=\"blob-code blob-code-inner js-file-line\">              99% &lt;= 215,41 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L42\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"42\"><\/td>\n          <td id=\"file-gistfile1-txt-LC42\" class=\"blob-code blob-code-inner js-file-line\">            99.9% &lt;= 215,41 milliseconds<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/mwiede\/c082106651eccacb3b720a8b83ba5109\/raw\/199ab46b32baed9aed6eb6e7194d291af45eb9e7\/gistfile1.txt\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/c082106651eccacb3b720a8b83ba5109#file-gistfile1-txt\" class=\"Link--inTextBlock\">\n          gistfile1.txt\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<h3>httpclient example<\/h3>\n<div id=\"gist82800240\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-httpclientexample-java\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-java  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"HttpClientExample.java content, created by mwiede on 09:04AM on November 07, 2017.\">\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      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.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"%7B%7B%20revealButtonHref%20%7D%7D\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"HttpClientExample.java\">\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-httpclientexample-java-LC1\" class=\"blob-code blob-code-inner js-file-line\">MetricRegistry metricRegistry = new MetricRegistry();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-httpclientexample-java-LC2\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-httpclientexample-java-LC3\" class=\"blob-code blob-code-inner js-file-line\">final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-httpclientexample-java-LC4\" class=\"blob-code blob-code-inner js-file-line\">        .convertDurationsTo(TimeUnit.MILLISECONDS).build();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-httpclientexample-java-LC5\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-httpclientexample-java-LC6\" class=\"blob-code blob-code-inner js-file-line\">GitHub github = Feign.builder().invocationHandlerFactory(<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-httpclientexample-java-LC7\" class=\"blob-code blob-code-inner js-file-line\">        \/\/ instrument feign<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-httpclientexample-java-LC8\" class=\"blob-code blob-code-inner js-file-line\">        new FeignOutboundMetricsDecorator(new InvocationHandlerFactory.Default(), metricRegistry)).client(<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-httpclientexample-java-LC9\" class=\"blob-code blob-code-inner js-file-line\">        \/\/ setting an instrumented httpclient<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-httpclientexample-java-LC10\" class=\"blob-code blob-code-inner js-file-line\">        new ApacheHttpClient(InstrumentedHttpClients<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-httpclientexample-java-LC11\" class=\"blob-code blob-code-inner js-file-line\">                .createDefault(metricRegistry, HttpClientMetricNameStrategies.HOST_AND_METHOD)))<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-httpclientexample-java-LC12\" class=\"blob-code blob-code-inner js-file-line\">        .decoder(new GsonDecoder()).target(GitHub.class, \"https:\/\/api.github.com\");<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-httpclientexample-java-LC13\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-httpclientexample-java-LC14\" class=\"blob-code blob-code-inner js-file-line\">execute...<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-httpclientexample-java-LC15\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-httpclientexample-java-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-httpclientexample-java-LC16\" class=\"blob-code blob-code-inner js-file-line\">reporter.report();<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/mwiede\/30864cabac831ca25e528d35ec76cb69\/raw\/ee36248bf377f8dadad508271f574065d81bdda6\/HttpClientExample.java\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/30864cabac831ca25e528d35ec76cb69#file-httpclientexample-java\" class=\"Link--inTextBlock\">\n          HttpClientExample.java\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p>Metric output:<\/p>\n<div id=\"gist82800403\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-gistfile1-txt\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-text  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"gistfile1.txt content, created by mwiede on 09:11AM on November 07, 2017.\">\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      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.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"%7B%7B%20revealButtonHref%20%7D%7D\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"gistfile1.txt\">\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-gistfile1-txt-LC1\" class=\"blob-code blob-code-inner js-file-line\">-- Gauges ----------------------------------------------------------------------<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-gistfile1-txt-LC2\" class=\"blob-code blob-code-inner js-file-line\">org.apache.http.conn.HttpClientConnectionManager.available-connections<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-gistfile1-txt-LC3\" class=\"blob-code blob-code-inner js-file-line\">             value = 1<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-gistfile1-txt-LC4\" class=\"blob-code blob-code-inner js-file-line\">org.apache.http.conn.HttpClientConnectionManager.leased-connections<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-gistfile1-txt-LC5\" class=\"blob-code blob-code-inner js-file-line\">             value = 0<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-gistfile1-txt-LC6\" class=\"blob-code blob-code-inner js-file-line\">org.apache.http.conn.HttpClientConnectionManager.max-connections<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-gistfile1-txt-LC7\" class=\"blob-code blob-code-inner js-file-line\">             value = 20<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-gistfile1-txt-LC8\" class=\"blob-code blob-code-inner js-file-line\">org.apache.http.conn.HttpClientConnectionManager.pending-connections<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-gistfile1-txt-LC9\" class=\"blob-code blob-code-inner js-file-line\">             value = 0<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-gistfile1-txt-LC10\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-gistfile1-txt-LC11\" class=\"blob-code blob-code-inner js-file-line\">-- Meters ----------------------------------------------------------------------<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-gistfile1-txt-LC12\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-gistfile1-txt-LC13\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-gistfile1-txt-LC14\" class=\"blob-code blob-code-inner js-file-line\">-- Timers ----------------------------------------------------------------------<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-gistfile1-txt-LC15\" class=\"blob-code blob-code-inner js-file-line\">org.apache.http.client.HttpClient.api.github.com.get-requests<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-gistfile1-txt-LC16\" class=\"blob-code blob-code-inner js-file-line\">             count = 1<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-gistfile1-txt-LC17\" class=\"blob-code blob-code-inner js-file-line\">         mean rate = 4,19 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-gistfile1-txt-LC18\" class=\"blob-code blob-code-inner js-file-line\">     1-minute rate = 0,00 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-gistfile1-txt-LC19\" class=\"blob-code blob-code-inner js-file-line\">     5-minute rate = 0,00 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-gistfile1-txt-LC20\" class=\"blob-code blob-code-inner js-file-line\">    15-minute rate = 0,00 calls\/second<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-gistfile1-txt-LC21\" class=\"blob-code blob-code-inner js-file-line\">               min = 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-gistfile1-txt-LC22\" class=\"blob-code blob-code-inner js-file-line\">               max = 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-gistfile1-txt-LC23\" class=\"blob-code blob-code-inner js-file-line\">              mean = 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-gistfile1-txt-LC24\" class=\"blob-code blob-code-inner js-file-line\">            stddev = 0,00 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-gistfile1-txt-LC25\" class=\"blob-code blob-code-inner js-file-line\">            median = 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-gistfile1-txt-LC26\" class=\"blob-code blob-code-inner js-file-line\">              75% &lt;= 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-gistfile1-txt-LC27\" class=\"blob-code blob-code-inner js-file-line\">              95% &lt;= 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-gistfile1-txt-LC28\" class=\"blob-code blob-code-inner js-file-line\">              98% &lt;= 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-gistfile1-txt-LC29\" class=\"blob-code blob-code-inner js-file-line\">              99% &lt;= 174,59 milliseconds<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-gistfile1-txt-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-gistfile1-txt-LC30\" class=\"blob-code blob-code-inner js-file-line\">            99.9% &lt;= 174,59 milliseconds<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/mwiede\/7e2f494ff4b221bd4c7d703a7dfcde88\/raw\/cce439733cec8c26f33667a2ecc200661c0762fb\/gistfile1.txt\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/7e2f494ff4b221bd4c7d703a7dfcde88#file-gistfile1-txt\" class=\"Link--inTextBlock\">\n          gistfile1.txt\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p>As you can see, the provided metrics only provid information on http level, not really showing differences between different service endpoints. The only differentation is available on the httpclient metrics, which shows metrics based on host and http methods.<\/p>\n<h2>Closing the gap<\/h2>\n<p>What was missing in my eyes was a way to instrument metrics on the interface level, which is provided from the Feign builder. In my example below I am calling the github API on two different resource endpoints, contributors and repositorySearch. With the instrumentation on http, one is not able to see and monitor those one by one.<\/p>\n<p>Therefore I created a library, which makes it possible to instrument metrics on method or interface level by using annotations like you do it in jersey resource classes.<\/p>\n<p>Using this instrumentation you are able to retrieve metrics based on the interface and methods the client is calling. So for example when you start reporting via JMX, you are able to see the metrics in jconsole.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-86 size-full\" src=\"https:\/\/www.matez.de\/wp-content\/uploads\/2017\/10\/2017-11-07-10_36_48-Java-Monitoring-Management-Console-pid_-8168-com.github.mwiede.metrics.examp_.png\" alt=\"\" width=\"460\" height=\"244\" srcset=\"https:\/\/www.matez.de\/wp-content\/uploads\/2017\/10\/2017-11-07-10_36_48-Java-Monitoring-Management-Console-pid_-8168-com.github.mwiede.metrics.examp_.png 460w, https:\/\/www.matez.de\/wp-content\/uploads\/2017\/10\/2017-11-07-10_36_48-Java-Monitoring-Management-Console-pid_-8168-com.github.mwiede.metrics.examp_-300x159.png 300w\" sizes=\"(max-width: 460px) 85vw, 460px\" \/><\/p>\n<h3>Usage of the library<\/h3>\n<p>To instrument the feign interfaces you basically have to do three things:<\/p>\n<ol>\n<li>add the maven dependency to the pom.xml of your project.\n<pre>&lt;<span class=\"pl-ent\">dependency<\/span>&gt;\r\n  &lt;<span class=\"pl-ent\">groupId<\/span>&gt;com.github.mwiede&lt;\/<span class=\"pl-ent\">groupId<\/span>&gt;\r\n  &lt;<span class=\"pl-ent\">artifactId<\/span>&gt;metrics-feign&lt;\/<span class=\"pl-ent\">artifactId<\/span>&gt;\r\n  &lt;<span class=\"pl-ent\">version<\/span>&gt;1.0&lt;\/<span class=\"pl-ent\">version<\/span>&gt;\r\n&lt;\/<span class=\"pl-ent\">dependency<\/span>&gt;<\/pre>\n<\/li>\n<li>add FeignOutboundMetricsDecorator as invocationHandlerFactory in Feign.builder<\/li>\n<li>add the metric annotations @Timed, @Metered and @ExceptionMetered to the interface you are using with feign.<\/li>\n<\/ol>\n<div id=\"gist82801466\" class=\"gist\">\n    <div class=\"gist-file\" translate=\"no\" data-color-mode=\"light\" data-light-theme=\"light\">\n      <div class=\"gist-data\">\n        \n<div class=\"js-gist-file-update-container js-task-list-container\">\n      <div id=\"file-example-java\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-java  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"Example.java content, created by mwiede on 09:55AM on November 07, 2017.\">\n\n        \n<div class=\"js-check-hidden-unicode js-blob-code-container blob-code-content\">\n\n  <template class=\"js-file-alert-template\">\n  <div data-view-component=\"true\" class=\"flash flash-warn flash-full d-flex flex-items-center\">\n  <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n    <span>\n      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.\n      <a class=\"Link--inTextBlock\" href=\"https:\/\/github.co\/hiddenchars\" target=\"_blank\">Learn more about bidirectional Unicode characters<\/a>\n    <\/span>\n\n\n  <div data-view-component=\"true\" class=\"flash-action\">        <a href=\"%7B%7B%20revealButtonHref%20%7D%7D\" data-view-component=\"true\" class=\"btn-sm btn\">    Show hidden characters\n<\/a>\n<\/div>\n<\/div><\/template>\n<template class=\"js-line-alert-template\">\n  <span aria-label=\"This line has hidden Unicode characters\" data-view-component=\"true\" class=\"line-alert tooltipped tooltipped-e\">\n    <svg aria-hidden=\"true\" data-component=\"Octicon\" height=\"16\" viewbox=\"0 0 16 16\" version=\"1.1\" width=\"16\" data-view-component=\"true\" class=\"octicon octicon-alert\">\n    <path d=\"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z\"><\/path>\n<\/svg>\n<\/span><\/template>\n\n  <table data-hpc class=\"highlight tab-size js-file-line-container\" data-tab-size=\"4\" data-paste-markdown-skip data-tagsearch-path=\"Example.java\">\n        <tr class=\"line\">\n          <td id=\"file-example-java-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-example-java-LC1\" class=\"blob-code blob-code-inner js-file-line\">@Timed<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-example-java-LC2\" class=\"blob-code blob-code-inner js-file-line\">@Metered<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-example-java-LC3\" class=\"blob-code blob-code-inner js-file-line\">@ExceptionMetered<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-example-java-LC4\" class=\"blob-code blob-code-inner js-file-line\">interface GitHub {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-example-java-LC5\" class=\"blob-code blob-code-inner js-file-line\">    @RequestLine(\"GET \/repos\/{owner}\/{repo}\/contributors\")<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-example-java-LC6\" class=\"blob-code blob-code-inner js-file-line\">    List&lt;Contributor&gt; contributors(@Param(\"owner\") String owner, @Param(\"repo\") String repo);<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-example-java-LC7\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-example-java-LC8\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-example-java-LC9\" class=\"blob-code blob-code-inner js-file-line\">static class Contributor {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-example-java-LC10\" class=\"blob-code blob-code-inner js-file-line\">    String login;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-example-java-LC11\" class=\"blob-code blob-code-inner js-file-line\">    int contributions;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-example-java-LC12\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-example-java-LC13\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-example-java-LC14\" class=\"blob-code blob-code-inner js-file-line\">public static void main(String... args) {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-example-java-LC15\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-example-java-LC16\" class=\"blob-code blob-code-inner js-file-line\">    MetricRegistry metricRegistry = new MetricRegistry();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-example-java-LC17\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-example-java-LC18\" class=\"blob-code blob-code-inner js-file-line\">    final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-example-java-LC19\" class=\"blob-code blob-code-inner js-file-line\">            .convertDurationsTo(TimeUnit.MILLISECONDS).build();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-example-java-LC20\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-example-java-LC21\" class=\"blob-code blob-code-inner js-file-line\">    GitHub github = Feign.builder().invocationHandlerFactory(<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-example-java-LC22\" class=\"blob-code blob-code-inner js-file-line\">            new FeignOutboundMetricsDecorator(new InvocationHandlerFactory.Default(), metricRegistry))<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-example-java-LC23\" class=\"blob-code blob-code-inner js-file-line\">            .decoder(new GsonDecoder()).target(GitHub.class, \"https:\/\/api.github.com\");<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-example-java-LC24\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-example-java-LC25\" class=\"blob-code blob-code-inner js-file-line\">    \/\/ Fetch and print a list of the contributors to this library.<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-example-java-LC26\" class=\"blob-code blob-code-inner js-file-line\">    List&lt;Contributor&gt; contributors = github.contributors(\"mwiede\", \"metrics-feign\");<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-example-java-LC27\" class=\"blob-code blob-code-inner js-file-line\">    for (Contributor contributor : contributors) {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-example-java-LC28\" class=\"blob-code blob-code-inner js-file-line\">        System.out.println(contributor.login + \" (\" + contributor.contributions + \")\");<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-example-java-LC29\" class=\"blob-code blob-code-inner js-file-line\">    }<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-example-java-LC30\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-example-java-LC31\" class=\"blob-code blob-code-inner js-file-line\">    reporter.report();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-example-java-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-example-java-LC32\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n        <\/tr>\n  <\/table>\n<\/div>\n\n\n    <\/div>\n\n  <\/div>\n\n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/mwiede\/09dde211a9bf5f3813ca11cbf2be184f\/raw\/594c91ec2da1856c62bcef542c968b19c593b2c4\/Example.java\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/09dde211a9bf5f3813ca11cbf2be184f#file-example-java\" class=\"Link--inTextBlock\">\n          Example.java\n        <\/a>\n        hosted with &#10084; by <a class=\"Link--inTextBlock\" href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p>The library is available from <a href=\"http:\/\/search.maven.org\/#search%7Cga%7C1%7Ca%3A%22metrics-feign%22\">maven central<\/a> and the source is hosted at github, so please checkout\u00a0<a href=\"https:\/\/github.com\/mwiede\/metrics-feign\">https:\/\/github.com\/mwiede\/metrics-feign<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>With dropwizard microservices, you can easily add inbound metrics on your jax-rs http resource classes via annotations: The metrics can easily been reported to graphite database and visualized via Kibana. WYIIWYG &#8211; What you instrument, is what you get! On the other hand, a microservice often contains client libraries to access other services via http. &hellip; <a href=\"https:\/\/www.matez.de\/index.php\/2017\/10\/29\/feign-outbound-metrics\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Feign Outbound metrics\u00a0&#8220;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[9,3,6],"_links":{"self":[{"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/posts\/74"}],"collection":[{"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":8,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/posts\/74\/revisions\/89"}],"wp:attachment":[{"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}