| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <title>org.eclipse.microprofile.metrics.annotation</title> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| |
| <link rel="shortcut icon" href="/img/microprofile-favicon.png"> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="org.eclipse.microprofile.metrics.annotation"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li class="navBarCell1Rev">Package</li> |
| <li>Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/eclipse/microprofile/metrics/package-summary.html">Prev Package</a></li> |
| <li><a href="../../../../../org/eclipse/microprofile/metrics/tck/package-summary.html">Next Package</a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/eclipse/microprofile/metrics/annotation/package-summary.html" target="_top">Frames</a></li> |
| <li><a href="package-summary.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <div class="header"> |
| <h1 title="Package" class="title">Package org.eclipse.microprofile.metrics.annotation</h1> |
| <div class="docSummary"> |
| <div class="block"> |
| This package contains the annotations used for MicroProfile Metrics.</div> |
| </div> |
| <p>See: <a href="#package.description">Description</a></p> |
| </div> |
| <div class="contentContainer"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Annotation Types Summary table, listing annotation types, and an explanation"> |
| <caption><span>Annotation Types Summary</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Annotation Type</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tbody> |
| <tr class="altColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/ConcurrentGauge.html" title="annotation in org.eclipse.microprofile.metrics.annotation">ConcurrentGauge</a></td> |
| <td class="colLast"> |
| <div class="block">An annotation for marking a method, constructor, or class as concurrent gauged.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/Counted.html" title="annotation in org.eclipse.microprofile.metrics.annotation">Counted</a></td> |
| <td class="colLast"> |
| <div class="block">An annotation for marking a method, constructor, or class as counted.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/Gauge.html" title="annotation in org.eclipse.microprofile.metrics.annotation">Gauge</a></td> |
| <td class="colLast"> |
| <div class="block">An annotation for marking a method or field as a gauge.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/Metered.html" title="annotation in org.eclipse.microprofile.metrics.annotation">Metered</a></td> |
| <td class="colLast"> |
| <div class="block">An annotation for marking a method, constructor, or class as metered.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/Metric.html" title="annotation in org.eclipse.microprofile.metrics.annotation">Metric</a></td> |
| <td class="colLast"> |
| <div class="block">An annotation requesting that a metric be injected or registered.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/RegistryType.html" title="annotation in org.eclipse.microprofile.metrics.annotation">RegistryType</a></td> |
| <td class="colLast"> |
| <div class="block">Qualifies the type of Metric Registry to inject.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/SimplyTimed.html" title="annotation in org.eclipse.microprofile.metrics.annotation">SimplyTimed</a></td> |
| <td class="colLast"> |
| <div class="block">An annotation for marking a method, constructor, or class as simply timed.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><a href="../../../../../org/eclipse/microprofile/metrics/annotation/Timed.html" title="annotation in org.eclipse.microprofile.metrics.annotation">Timed</a></td> |
| <td class="colLast"> |
| <div class="block">An annotation for marking a method, constructor, or class as timed.</div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </li> |
| </ul> |
| <a name="package.description"> |
| <!-- --> |
| </a> |
| <h2 title="Package org.eclipse.microprofile.metrics.annotation Description">Package org.eclipse.microprofile.metrics.annotation Description</h2> |
| <div class="block"><p> |
| This package contains the annotations used for MicroProfile Metrics. |
| |
| <h2>Metric Annotation</h2> |
| <p> |
| The <a href="../../../../../org/eclipse/microprofile/metrics/annotation/Metric.html" title="annotation in org.eclipse.microprofile.metrics.annotation"><code>Metric</code></a> annotation is used to provide metadata for the |
| metric being injected. If a metric with the same name exists in the |
| <a href="../../../../../org/eclipse/microprofile/metrics/MetricRegistry.html" title="interface in org.eclipse.microprofile.metrics"><code>MetricRegistry</code></a>, the metric is returned. Otherwise, a new |
| metric is registered into the MetricRegistry along with the metadata provided by the @Metric annotation. |
| <p> |
| For example, |
| |
| <pre> |
| <code> |
| @Inject |
| @Metric(name="histogram", description="The description") |
| public Histogram histogram; |
| </code> |
| </pre> |
| |
| <h2>Interceptor Bindings</h2> |
| <p> |
| MicroProfile Metrics provides interceptor bindings which can be used to instrument an application: |
| @Counted, @Gauge, @Metered, @Timed, @SimplyTimed and |
| @ConcurrentGauge. |
| <p> |
| An example using @Counted, |
| |
| <pre> |
| <code> |
| @Counted (name="visitorCount", |
| description="The number of visitors to the application") |
| public void visit () { |
| ... |
| } |
| </code> |
| </pre> |
| <p> |
| An example using @Gauge, |
| |
| <pre> |
| <code> |
| @Gauge(name = "queueSize") |
| public int getQueueSize() { |
| return queue.size; |
| } |
| </code> |
| </pre> |
| |
| |
| <h2>CDI Qualifier</h2> |
| <p> |
| The <a href="../../../../../org/eclipse/microprofile/metrics/annotation/RegistryType.html" title="annotation in org.eclipse.microprofile.metrics.annotation"><code>RegistryType</code></a> is used to identify which |
| <code>MetricRegistry</code> (Application, Base, or Vendor) should be injected. By default, no |
| <code>RegistryType</code> will inject the application <code>MetricRegistry</code>. |
| |
| <pre> |
| <code> |
| @Inject |
| @RegistryType(type=MetricRegistry.Type.BASE) |
| MetricRegistry baseRegistry; |
| </code> |
| </pre></div> |
| </div> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li class="navBarCell1Rev">Package</li> |
| <li>Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/eclipse/microprofile/metrics/package-summary.html">Prev Package</a></li> |
| <li><a href="../../../../../org/eclipse/microprofile/metrics/tck/package-summary.html">Next Package</a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/eclipse/microprofile/metrics/annotation/package-summary.html" target="_top">Frames</a></li> |
| <li><a href="package-summary.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |