/
package-info.java
152 lines (151 loc) · 4.49 KB
/
package-info.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
**********************************************************************
* Copyright (c) 2017, 2018 Contributors to the Eclipse Foundation
*
* See the NOTICES file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
**********************************************************************/
/**
* MicroProfile Metrics
*
* <h2>Rational</h2>
*
* <p>
* To ensure reliable operation of software it is necessary to monitor essential
* system parameters. There is already JMX as standard to expose metrics, but
* remote-JMX is not easy to deal with and especially does not fit well in a
* polyglot environment where other services are not running on the JVM. To
* enable monitoring in an easy fashion, the MicroProfile Metrics specification
* provides a standard to instrument an application with metrics and provides a
* simple REST endpoint for integration with monitoring services.
*
* <h2>Adding Metrics</h2>
* <p>
* MicroProfile Metrics provides 6 different metric types that can be used to
* instrument an application. Developers can create an accompanying
* {@link org.eclipse.microprofile.metrics.Metadata Metadata} object to supply
* the metric's name, description, display name, and units. Once the
* metric and the metadata are registered against the application
* {@link org.eclipse.microprofile.metrics.MetricRegistry MetricRegistry}, the
* metrics will be available in the REST endpoints.
*
* <h2>Metric Types</h2>
*
* <p>
* {@link org.eclipse.microprofile.metrics.Counter Counter} is used to measure
* an increasing value.
* <p>
* Example usage:
*
* <pre>
* <code>
* Counter count = metricRegistry.counter(metadata);
* count.inc();
* </code>
* </pre>
*
* <p>
* {@link org.eclipse.microprofile.metrics.ConcurrentGauge ConcurrentGauge} is used
* to monitor the number of concurrent invocations of a component.
* <p>
* Example usage:
*
* <pre>
* <code>
* ConcurrentGauge cgauge = metricRegistry.concurrentGauge(metadata);
* cgauge.inc();
* // .. a block of code that can be executed by multiple threads at the same time
* cgauge.dec();
* </code>
* </pre>
*
* {@link org.eclipse.microprofile.metrics.Gauge Gauge} is used to provide the
* immediate measurement of a value.
* <p>
* Example usage:
*
* <pre>
* <code>
* Gauge<Double> temperature = new Gauge<Double>() {
* public Double getValue() {
* return getTemperature();
* }
* };
* metricRegistry.register(metadata, temperature);
* </code>
* </pre>
*
*
* {@link org.eclipse.microprofile.metrics.Meter Meter} is used to measure the
* frequency of an event.
* <p>
* Example usage:
*
* <pre>
* <code>
* Meter meter = metricRegistry.meter(metadata);
* meter.mark();
* </code>
* </pre>
*
*
* {@link org.eclipse.microprofile.metrics.Histogram Histogram} is used to
* sample and compute the distribution of values
* <p>
* Example usage:
*
* <pre>
* <code>
* Histogram histogram = metricRegistry.histogram(metadata);
* histogram.update(score);
* </code>
* </pre>
*
* {@link org.eclipse.microprofile.metrics.Timer Timer} is used to measure the
* duration of an event as well as the frequency of occurrence.
* <p>
* Example usage:
*
* <pre>
* <code>
* Timer timer = metricRegistry.timer(metadata);
* Timer.Context context = timer.time();
*
* ... // code that will be timed
*
* context.close();
* </code>
* </pre>
*
* {@link org.eclipse.microprofile.metrics.SimpleTimer SimpleTimer} is used to measure the
* duration of an event.
* <p>
* Example usage:
*
* <pre>
* <code>
* SimpleTimer simpleTimer = metricRegistry.simpleTimer(metadata);
* SimpleTimer.Context context = simpleTimer.time();
*
* ... // code that will be timed
*
* context.close();
* </code>
* </pre>
*/
@org.osgi.annotation.versioning.Version("2.3")
package org.eclipse.microprofile.metrics;