{"id":60,"date":"2017-06-23T19:49:23","date_gmt":"2017-06-23T19:49:23","guid":{"rendered":"http:\/\/www.matez.de\/?p=60"},"modified":"2017-07-02T21:34:35","modified_gmt":"2017-07-02T21:34:35","slug":"jax-rs-codahaledropwizard-metrics-cdi-prometheus","status":"publish","type":"post","link":"https:\/\/www.matez.de\/index.php\/2017\/06\/23\/jax-rs-codahaledropwizard-metrics-cdi-prometheus\/","title":{"rendered":"Jax-RS + Codahale\/dropwizard metrics + CDI + Prometheus"},"content":{"rendered":"<p>I used to use dropwizard built-in metrics annotations and graphite, but now I wanted to integrate these into my javaee project exposing prometheus metrics format. The main difference between graphite and prometheus is the push or pull mentality. So instead of pushing the metrics data to the sink, they are provided via http servlet and the prometheus server is scraping them from there.<\/p>\n<p>There are two registry classes which we have to bring together. One is the\u00a0com.codahale.metrics.MetricRegistry which holds all codahale metrics and the other one is the\u00a0io.prometheus.client.CollectorRegistry which holds all metrics being published in the prometheus. So in our case, we will receive all metrics from our Jax-RS resource classes annotated with\u00a0com.codahale.metrics.annotation.Timed or\u00a0com.codahale.metrics.annotation.ExceptionMetered.<\/p>\n<p>The prometheus library contains some default Jvm metrics (DefaultExports), but I could not use them because of some sun jdk classes which do not exist in OpenJDK for example. But it is good to add these in addition to the metrics coming from our annotated Jax-RS resource classes. So this is the class<\/p>\n<div id=\"gist50269799\" 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-metricsbean-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=\"MetricsBean.java content, created by mwiede on 09:17PM on June 23, 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\" 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\" 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=\"MetricsBean.java\">\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-metricsbean-java-LC1\" class=\"blob-code blob-code-inner js-file-line\">import io.prometheus.client.CollectorRegistry;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-metricsbean-java-LC2\" class=\"blob-code blob-code-inner js-file-line\">import io.prometheus.client.dropwizard.DropwizardExports;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-metricsbean-java-LC3\" class=\"blob-code blob-code-inner js-file-line\">import io.prometheus.client.hotspot.ClassLoadingExports;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-metricsbean-java-LC4\" class=\"blob-code blob-code-inner js-file-line\">import io.prometheus.client.hotspot.GarbageCollectorExports;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-metricsbean-java-LC5\" class=\"blob-code blob-code-inner js-file-line\">import io.prometheus.client.hotspot.MemoryPoolsExports;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-metricsbean-java-LC6\" class=\"blob-code blob-code-inner js-file-line\">import io.prometheus.client.hotspot.ThreadExports;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-metricsbean-java-LC7\" class=\"blob-code blob-code-inner js-file-line\">import io.prometheus.client.hotspot.VersionInfoExports;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-metricsbean-java-LC8\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-metricsbean-java-LC9\" class=\"blob-code blob-code-inner js-file-line\">import javax.enterprise.context.ApplicationScoped;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-metricsbean-java-LC10\" class=\"blob-code blob-code-inner js-file-line\">import javax.enterprise.context.Destroyed;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-metricsbean-java-LC11\" class=\"blob-code blob-code-inner js-file-line\">import javax.enterprise.context.Initialized;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-metricsbean-java-LC12\" class=\"blob-code blob-code-inner js-file-line\">import javax.enterprise.event.Observes;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-metricsbean-java-LC13\" class=\"blob-code blob-code-inner js-file-line\">import javax.inject.Inject;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-metricsbean-java-LC14\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-metricsbean-java-LC15\" class=\"blob-code blob-code-inner js-file-line\">import com.codahale.metrics.MetricRegistry;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-metricsbean-java-LC16\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-metricsbean-java-LC17\" class=\"blob-code blob-code-inner js-file-line\">\/**<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-metricsbean-java-LC18\" class=\"blob-code blob-code-inner js-file-line\"> * A bean, which is starting the metrics reporter during startup and its is shutting down the<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-metricsbean-java-LC19\" class=\"blob-code blob-code-inner js-file-line\"> * reporter when application is destroyed.<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-metricsbean-java-LC20\" class=\"blob-code blob-code-inner js-file-line\"> * <\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-metricsbean-java-LC21\" class=\"blob-code blob-code-inner js-file-line\"> *<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-metricsbean-java-LC22\" class=\"blob-code blob-code-inner js-file-line\"> *\/<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-metricsbean-java-LC23\" class=\"blob-code blob-code-inner js-file-line\">@ApplicationScoped<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-metricsbean-java-LC24\" class=\"blob-code blob-code-inner js-file-line\">public class MetricsBean {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-metricsbean-java-LC25\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L26\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"26\"><\/td>\n          <td id=\"file-metricsbean-java-LC26\" class=\"blob-code blob-code-inner js-file-line\">  @Inject<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L27\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"27\"><\/td>\n          <td id=\"file-metricsbean-java-LC27\" class=\"blob-code blob-code-inner js-file-line\">  private MetricRegistry registry;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L28\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"28\"><\/td>\n          <td id=\"file-metricsbean-java-LC28\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L29\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"29\"><\/td>\n          <td id=\"file-metricsbean-java-LC29\" class=\"blob-code blob-code-inner js-file-line\">  public void init(@Observes @Initialized(ApplicationScoped.class) final Object init) {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L30\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"30\"><\/td>\n          <td id=\"file-metricsbean-java-LC30\" class=\"blob-code blob-code-inner js-file-line\">    \/\/ DefaultExports.initialize();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L31\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"31\"><\/td>\n          <td id=\"file-metricsbean-java-LC31\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L32\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"32\"><\/td>\n          <td id=\"file-metricsbean-java-LC32\" class=\"blob-code blob-code-inner js-file-line\">    new MemoryPoolsExports().register();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L33\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"33\"><\/td>\n          <td id=\"file-metricsbean-java-LC33\" class=\"blob-code blob-code-inner js-file-line\">    new GarbageCollectorExports().register();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L34\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"34\"><\/td>\n          <td id=\"file-metricsbean-java-LC34\" class=\"blob-code blob-code-inner js-file-line\">    new ThreadExports().register();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L35\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"35\"><\/td>\n          <td id=\"file-metricsbean-java-LC35\" class=\"blob-code blob-code-inner js-file-line\">    new ClassLoadingExports().register();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L36\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"36\"><\/td>\n          <td id=\"file-metricsbean-java-LC36\" class=\"blob-code blob-code-inner js-file-line\">    new VersionInfoExports().register();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L37\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"37\"><\/td>\n          <td id=\"file-metricsbean-java-LC37\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L38\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"38\"><\/td>\n          <td id=\"file-metricsbean-java-LC38\" class=\"blob-code blob-code-inner js-file-line\">    CollectorRegistry.defaultRegistry.register(new DropwizardExports(registry));<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L39\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"39\"><\/td>\n          <td id=\"file-metricsbean-java-LC39\" class=\"blob-code blob-code-inner js-file-line\">  }<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L40\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"40\"><\/td>\n          <td id=\"file-metricsbean-java-LC40\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L41\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"41\"><\/td>\n          <td id=\"file-metricsbean-java-LC41\" class=\"blob-code blob-code-inner js-file-line\">  public void destroy(@Observes @Destroyed(ApplicationScoped.class) final Object init) {<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L42\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"42\"><\/td>\n          <td id=\"file-metricsbean-java-LC42\" class=\"blob-code blob-code-inner js-file-line\">    CollectorRegistry.defaultRegistry.clear();<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L43\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"43\"><\/td>\n          <td id=\"file-metricsbean-java-LC43\" class=\"blob-code blob-code-inner js-file-line\">  }<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L44\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"44\"><\/td>\n          <td id=\"file-metricsbean-java-LC44\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L45\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"45\"><\/td>\n          <td id=\"file-metricsbean-java-LC45\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-metricsbean-java-L46\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"46\"><\/td>\n          <td id=\"file-metricsbean-java-LC46\" 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\/3fae2b064b9814d6d408dc60a6e6ed2a\/raw\/b90f8ac96bd280afdd9a72d88f1b5eff022b9a61\/MetricsBean.java\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/3fae2b064b9814d6d408dc60a6e6ed2a#file-metricsbean-java\" class=\"Link--inTextBlock\">\n          MetricsBean.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>and these are the dependencies for the project:<\/p>\n<div id=\"gist51899453\" 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-pom-xml\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-maven-pom  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"pom.xml content, created by mwiede on 09:18PM on July 02, 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\" 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\" 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=\"pom.xml\">\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-pom-xml-LC1\" class=\"blob-code blob-code-inner js-file-line\">&lt;dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-pom-xml-LC2\" class=\"blob-code blob-code-inner js-file-line\">  &lt;groupId&gt;io.astefanutti.metrics.cdi&lt;\/groupId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-pom-xml-LC3\" class=\"blob-code blob-code-inner js-file-line\">  &lt;artifactId&gt;metrics-cdi&lt;\/artifactId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-pom-xml-LC4\" class=\"blob-code blob-code-inner js-file-line\">  &lt;version&gt;1.3.6&lt;\/version&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-pom-xml-LC5\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-pom-xml-LC6\" class=\"blob-code blob-code-inner js-file-line\">&lt;dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-pom-xml-LC7\" class=\"blob-code blob-code-inner js-file-line\">  &lt;groupId&gt;io.prometheus&lt;\/groupId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-pom-xml-LC8\" class=\"blob-code blob-code-inner js-file-line\">  &lt;artifactId&gt;simpleclient&lt;\/artifactId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-pom-xml-LC9\" class=\"blob-code blob-code-inner js-file-line\">  &lt;version&gt;0.0.23&lt;\/version&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-pom-xml-LC10\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-pom-xml-LC11\" class=\"blob-code blob-code-inner js-file-line\">&lt;dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-pom-xml-LC12\" class=\"blob-code blob-code-inner js-file-line\">  &lt;groupId&gt;io.prometheus&lt;\/groupId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-pom-xml-LC13\" class=\"blob-code blob-code-inner js-file-line\">  &lt;artifactId&gt;simpleclient_servlet&lt;\/artifactId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-pom-xml-LC14\" class=\"blob-code blob-code-inner js-file-line\">  &lt;version&gt;0.0.23&lt;\/version&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-pom-xml-LC15\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-pom-xml-LC16\" class=\"blob-code blob-code-inner js-file-line\">&lt;dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-pom-xml-LC17\" class=\"blob-code blob-code-inner js-file-line\">  &lt;groupId&gt;io.prometheus&lt;\/groupId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-pom-xml-LC18\" class=\"blob-code blob-code-inner js-file-line\">  &lt;artifactId&gt;simpleclient_dropwizard&lt;\/artifactId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-pom-xml-LC19\" class=\"blob-code blob-code-inner js-file-line\">  &lt;version&gt;0.0.23&lt;\/version&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L20\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"20\"><\/td>\n          <td id=\"file-pom-xml-LC20\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L21\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"21\"><\/td>\n          <td id=\"file-pom-xml-LC21\" class=\"blob-code blob-code-inner js-file-line\">&lt;dependency&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L22\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"22\"><\/td>\n          <td id=\"file-pom-xml-LC22\" class=\"blob-code blob-code-inner js-file-line\">  &lt;groupId&gt;io.prometheus&lt;\/groupId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L23\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"23\"><\/td>\n          <td id=\"file-pom-xml-LC23\" class=\"blob-code blob-code-inner js-file-line\">  &lt;artifactId&gt;simpleclient_hotspot&lt;\/artifactId&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L24\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"24\"><\/td>\n          <td id=\"file-pom-xml-LC24\" class=\"blob-code blob-code-inner js-file-line\">  &lt;version&gt;0.0.23&lt;\/version&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-pom-xml-L25\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"25\"><\/td>\n          <td id=\"file-pom-xml-LC25\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/dependency&gt;<\/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\/4e311e9a8f3f490bd505289a0c24f0a6\/raw\/57f5122f0504da5d75de68f60fa8c38a30d316b0\/pom.xml\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/4e311e9a8f3f490bd505289a0c24f0a6#file-pom-xml\" class=\"Link--inTextBlock\">\n          pom.xml\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, by the help of CDI we are able to bind everything together during the startup phase of the application inside of the JEE container.<\/p>\n<p>Then we add the \u00a0servlet to the web.xml like this and we are done:<\/p>\n<div id=\"gist50270851\" 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-web-xml\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-xml  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"Web.xml content, created by mwiede on 09:24PM on June 23, 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\" 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\" 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=\"Web.xml\">\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-web-xml-LC1\" class=\"blob-code blob-code-inner js-file-line\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-web-xml-LC2\" class=\"blob-code blob-code-inner js-file-line\">&lt;web-app xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns=\"http:\/\/java.sun.com\/xml\/ns\/javaee\" xsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd\" version=\"3.0\"&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-web-xml-LC3\" class=\"blob-code blob-code-inner js-file-line\">  &lt;welcome-file-list&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-web-xml-LC4\" class=\"blob-code blob-code-inner js-file-line\">    &lt;welcome-file&gt;\/index.html&lt;\/welcome-file&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-web-xml-LC5\" class=\"blob-code blob-code-inner js-file-line\">  &lt;\/welcome-file-list&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-web-xml-LC6\" class=\"blob-code blob-code-inner js-file-line\">  <\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-web-xml-LC7\" class=\"blob-code blob-code-inner js-file-line\">  &lt;!-- --&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-web-xml-LC8\" class=\"blob-code blob-code-inner js-file-line\">   <\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-web-xml-LC9\" class=\"blob-code blob-code-inner js-file-line\">   &lt;servlet&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-web-xml-LC10\" class=\"blob-code blob-code-inner js-file-line\">        &lt;servlet-name&gt;prometheusMetrics&lt;\/servlet-name&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-web-xml-LC11\" class=\"blob-code blob-code-inner js-file-line\">        &lt;servlet-class&gt;io.prometheus.client.exporter.MetricsServlet&lt;\/servlet-class&gt;      <\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-web-xml-LC12\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/servlet&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L13\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"13\"><\/td>\n          <td id=\"file-web-xml-LC13\" class=\"blob-code blob-code-inner js-file-line\">&lt;servlet-mapping&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L14\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"14\"><\/td>\n          <td id=\"file-web-xml-LC14\" class=\"blob-code blob-code-inner js-file-line\">        &lt;servlet-name&gt;prometheusMetrics&lt;\/servlet-name&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L15\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"15\"><\/td>\n          <td id=\"file-web-xml-LC15\" class=\"blob-code blob-code-inner js-file-line\">        &lt;url-pattern&gt;\/prometheusMetrics\/*&lt;\/url-pattern&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L16\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"16\"><\/td>\n          <td id=\"file-web-xml-LC16\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/servlet-mapping&gt;<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L17\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"17\"><\/td>\n          <td id=\"file-web-xml-LC17\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L18\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"18\"><\/td>\n          <td id=\"file-web-xml-LC18\" class=\"blob-code blob-code-inner js-file-line\">   <\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-web-xml-L19\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"19\"><\/td>\n          <td id=\"file-web-xml-LC19\" class=\"blob-code blob-code-inner js-file-line\">&lt;\/web-app&gt;<\/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\/1e9d2076528ac006ec9c4963a533bda4\/raw\/5a31eb80328d3b2b876080a96dd924e59fac265e\/Web.xml\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/1e9d2076528ac006ec9c4963a533bda4#file-web-xml\" class=\"Link--inTextBlock\">\n          Web.xml\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>In your prometheus server create a scrape config<\/p>\n<div id=\"gist51899617\" 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-prometheus-yml\" class=\"file my-2\">\n    \n    <div itemprop=\"text\" class=\"Box-body p-0 blob-wrapper data type-yaml  \" style=\"overflow: auto\" tabindex=\"0\" role=\"region\" aria-label=\"prometheus.yml content, created by mwiede on 09:20PM on July 02, 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\" 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\" 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=\"prometheus.yml\">\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L1\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"1\"><\/td>\n          <td id=\"file-prometheus-yml-LC1\" class=\"blob-code blob-code-inner js-file-line\">scrape_configs:<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L2\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"2\"><\/td>\n          <td id=\"file-prometheus-yml-LC2\" class=\"blob-code blob-code-inner js-file-line\">  - job_name:       'jaxrs'<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L3\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"3\"><\/td>\n          <td id=\"file-prometheus-yml-LC3\" class=\"blob-code blob-code-inner js-file-line\">    metrics_path: \/prometheusMetrics\/<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L4\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"4\"><\/td>\n          <td id=\"file-prometheus-yml-LC4\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L5\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"5\"><\/td>\n          <td id=\"file-prometheus-yml-LC5\" class=\"blob-code blob-code-inner js-file-line\">    # Override the global default and scrape targets from this job every 5 seconds.<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L6\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"6\"><\/td>\n          <td id=\"file-prometheus-yml-LC6\" class=\"blob-code blob-code-inner js-file-line\">    scrape_interval: 5s<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L7\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"7\"><\/td>\n          <td id=\"file-prometheus-yml-LC7\" class=\"blob-code blob-code-inner js-file-line\">\n<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L8\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"8\"><\/td>\n          <td id=\"file-prometheus-yml-LC8\" class=\"blob-code blob-code-inner js-file-line\">    static_configs:<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L9\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"9\"><\/td>\n          <td id=\"file-prometheus-yml-LC9\" class=\"blob-code blob-code-inner js-file-line\">      - targets: ['www.example.com:80']<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L10\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"10\"><\/td>\n          <td id=\"file-prometheus-yml-LC10\" class=\"blob-code blob-code-inner js-file-line\">        <\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L11\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"11\"><\/td>\n          <td id=\"file-prometheus-yml-LC11\" class=\"blob-code blob-code-inner js-file-line\">        labels:<\/td>\n        <\/tr>\n        <tr class=\"line\">\n          <td id=\"file-prometheus-yml-L12\" class=\"blob-num js-line-number js-blob-rnum\" data-line-number=\"12\"><\/td>\n          <td id=\"file-prometheus-yml-LC12\" class=\"blob-code blob-code-inner js-file-line\">          group: 'jaxrs'<\/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\/6beff868052081d1c63166cbf3237a9d\/raw\/f85435beac927163aeb5110c12db35081f8454e3\/prometheus.yml\" style=\"float:right\" class=\"Link--inTextBlock\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/mwiede\/6beff868052081d1c63166cbf3237a9d#file-prometheus-yml\" class=\"Link--inTextBlock\">\n          prometheus.yml\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>and you should be able to see you metrics in prometheus expression browser or Grafana.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-69 size-full\" src=\"https:\/\/www.matez.de\/wp-content\/uploads\/2017\/06\/grafana.png\" alt=\"\" width=\"970\" height=\"521\" srcset=\"https:\/\/www.matez.de\/wp-content\/uploads\/2017\/06\/grafana.png 970w, https:\/\/www.matez.de\/wp-content\/uploads\/2017\/06\/grafana-300x161.png 300w, https:\/\/www.matez.de\/wp-content\/uploads\/2017\/06\/grafana-768x413.png 768w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I used to use dropwizard built-in metrics annotations and graphite, but now I wanted to integrate these into my javaee project exposing prometheus metrics format. The main difference between graphite and prometheus is the push or pull mentality. So instead of pushing the metrics data to the sink, they are provided via http servlet and &hellip; <a href=\"https:\/\/www.matez.de\/index.php\/2017\/06\/23\/jax-rs-codahaledropwizard-metrics-cdi-prometheus\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Jax-RS + Codahale\/dropwizard metrics + CDI + Prometheus&#8221;<\/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":[8,9,10,6,7],"_links":{"self":[{"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/posts\/60"}],"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=60"}],"version-history":[{"count":8,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions\/71"}],"wp:attachment":[{"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matez.de\/index.php\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}