Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a2f70c6f
Commit
a2f70c6f
authored
Jan 22, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add javadocs to some Metrics interfaces
Fixes gh-250
parent
d23dab3b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
0 deletions
+92
-0
PrefixMetricGroupExporter.java
...oot/actuate/metrics/export/PrefixMetricGroupExporter.java
+18
-0
MetricReader.java
...ngframework/boot/actuate/metrics/reader/MetricReader.java
+17
-0
PrefixMetricReader.java
...ework/boot/actuate/metrics/reader/PrefixMetricReader.java
+6
-0
MultiMetricRepository.java
...oot/actuate/metrics/repository/MultiMetricRepository.java
+20
-0
RichGaugeReader.java
...gframework/boot/actuate/metrics/rich/RichGaugeReader.java
+14
-0
MetricWriter.java
...ngframework/boot/actuate/metrics/writer/MetricWriter.java
+17
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/PrefixMetricGroupExporter.java
View file @
a2f70c6f
...
...
@@ -26,6 +26,9 @@ import org.springframework.boot.actuate.metrics.repository.MultiMetricRepository
import
org.springframework.boot.actuate.metrics.writer.MetricWriter
;
/**
* A convenient exporter for a group of metrics from a {@link PrefixMetricReader}. Exports
* all metrics whose name starts with a prefix (or all metrics if the prefix is empty).
*
* @author Dave Syer
*/
public
class
PrefixMetricGroupExporter
extends
AbstractMetricExporter
{
...
...
@@ -36,10 +39,25 @@ public class PrefixMetricGroupExporter extends AbstractMetricExporter {
private
Set
<
String
>
groups
=
new
HashSet
<
String
>();
/**
* Create a new exporter for metrics to a writer based on an empty prefix for the
* metric names.
*
* @param reader a reader as the source of metrics
* @param writer the writer to send the metrics to
*/
public
PrefixMetricGroupExporter
(
PrefixMetricReader
reader
,
MetricWriter
writer
)
{
this
(
reader
,
writer
,
""
);
}
/**
* Create a new exporter for metrics to a writer based on a prefix for the metric
* names.
*
* @param reader a reader as the source of metrics
* @param writer the writer to send the metrics to
* @param prefix the prefix for metrics to export
*/
public
PrefixMetricGroupExporter
(
PrefixMetricReader
reader
,
MetricWriter
writer
,
String
prefix
)
{
super
(
prefix
);
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/MetricReader.java
View file @
a2f70c6f
...
...
@@ -25,10 +25,27 @@ import org.springframework.boot.actuate.metrics.Metric;
*/
public
interface
MetricReader
{
/**
* Find an instance of the metric with the given name (usually the latest recorded
* value).
*
* @param metricName the name of the metric to find
* @return a metric value or null if there are none with that name
*/
Metric
<?>
findOne
(
String
metricName
);
/**
* Find all the metrics known to this reader.
*
* @return all instances of metrics known to this reader
*/
Iterable
<
Metric
<?>>
findAll
();
/**
* The number of metrics known to this reader.
*
* @return the number of metrics
*/
long
count
();
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/reader/PrefixMetricReader.java
View file @
a2f70c6f
...
...
@@ -25,6 +25,12 @@ import org.springframework.boot.actuate.metrics.Metric;
*/
public
interface
PrefixMetricReader
{
/**
* Find all metrics whose name starts with the given prefix.
*
* @param prefix the prefix for metric names
* @return all metrics with names starting with the prefix
*/
Iterable
<
Metric
<?>>
findAll
(
String
prefix
);
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/MultiMetricRepository.java
View file @
a2f70c6f
...
...
@@ -29,12 +29,32 @@ import org.springframework.boot.actuate.metrics.reader.PrefixMetricReader;
*/
public
interface
MultiMetricRepository
extends
PrefixMetricReader
{
/**
* Save some metric values and associate them with a group name.
*
* @param group the name of the group
* @param values the metric values to save
*/
void
save
(
String
group
,
Collection
<
Metric
<?>>
values
);
/**
* Rest the values of all metrics in the group. Implementations may choose to discard
* the old values.
*
* @param group reset the whole group
*/
void
reset
(
String
group
);
/**
* The names of all the groups known to this repository
*
* @return all available group names
*/
Iterable
<
String
>
groups
();
/**
* @return the number of groups available
*/
long
count
();
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/rich/RichGaugeReader.java
View file @
a2f70c6f
...
...
@@ -23,10 +23,24 @@ package org.springframework.boot.actuate.metrics.rich;
*/
public
interface
RichGaugeReader
{
/**
* Find a single instance of a rich gauge by name.
*
* @param name the name of the gauge
* @return a rich gauge value
*/
RichGauge
findOne
(
String
name
);
/**
* Find all instances of rich gauge known to this reader.
*
* @return all instances known to this reader
*/
Iterable
<
RichGauge
>
findAll
();
/**
* @return the number of gauge values available
*/
long
count
();
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/writer/MetricWriter.java
View file @
a2f70c6f
...
...
@@ -25,10 +25,27 @@ import org.springframework.boot.actuate.metrics.Metric;
*/
public
interface
MetricWriter
{
/**
* Increment the value of a metric (or decrement if the delta is negative). The name
* of the delta is the name of the metric to increment.
*
* @param delta the amount to increment by
*/
void
increment
(
Delta
<?>
delta
);
/**
* Set the value of a metric.
*
* @param value
*/
void
set
(
Metric
<?>
value
);
/**
* Reset the value of a metric, usually to zero value. Implementations can discard the
* old values if desired, but may choose not to.
*
* @param metricName the name to reset
*/
void
reset
(
String
metricName
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment