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
2f28a101
Commit
2f28a101
authored
Jul 18, 2014
by
Christian Dupuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish and re-add author name
parent
2be6b3e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
SystemPublicMetrics.java
...gframework/boot/actuate/endpoint/SystemPublicMetrics.java
+11
-12
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java
View file @
2f28a101
...
...
@@ -29,10 +29,10 @@ import org.springframework.boot.actuate.metrics.Metric;
import
org.springframework.util.StringUtils
;
/**
* A {@link PublicMetrics} implementation that provides various
* system-related metrics.
*
* A {@link PublicMetrics} implementation that provides various system-related metrics.
*
* @author Dave Syer
* @author Christian Dupuis
* @author Stephane Nicoll
* @since 1.2.0
*/
...
...
@@ -57,20 +57,17 @@ public class SystemPublicMetrics implements PublicMetrics {
return
result
;
}
/**
* Add basic system metrics.
*/
protected
void
addBasicMetrics
(
Collection
<
Metric
<?>>
result
)
{
result
.
add
(
new
Metric
<
Long
>(
"mem"
,
Runtime
.
getRuntime
().
totalMemory
()
/
1024
));
result
.
add
(
new
Metric
<
Long
>(
"mem.free"
,
Runtime
.
getRuntime
()
.
freeMemory
()
/
1024
));
result
.
add
(
new
Metric
<
Long
>(
"mem"
,
Runtime
.
getRuntime
().
totalMemory
()
/
1024
));
result
.
add
(
new
Metric
<
Long
>(
"mem.free"
,
Runtime
.
getRuntime
().
freeMemory
()
/
1024
));
result
.
add
(
new
Metric
<
Integer
>(
"processors"
,
Runtime
.
getRuntime
()
.
availableProcessors
()));
// Add JVM up time in ms
result
.
add
(
new
Metric
<
Long
>(
"uptime"
,
ManagementFactory
.
get
RuntimeMXBean
().
get
Uptime
()));
result
.
add
(
new
Metric
<
Long
>(
"uptime"
,
ManagementFactory
.
getRuntimeMXBean
()
.
getUptime
()));
result
.
add
(
new
Metric
<
Long
>(
"instance.uptime"
,
System
.
currentTimeMillis
()
-
this
.
timestamp
));
}
...
...
@@ -120,8 +117,10 @@ public class SystemPublicMetrics implements PublicMetrics {
.
getGarbageCollectorMXBeans
();
for
(
GarbageCollectorMXBean
garbageCollectorMXBean
:
garbageCollectorMxBeans
)
{
String
name
=
beautifyGcName
(
garbageCollectorMXBean
.
getName
());
result
.
add
(
new
Metric
<
Long
>(
"gc."
+
name
+
".count"
,
garbageCollectorMXBean
.
getCollectionCount
()));
result
.
add
(
new
Metric
<
Long
>(
"gc."
+
name
+
".time"
,
garbageCollectorMXBean
.
getCollectionTime
()));
result
.
add
(
new
Metric
<
Long
>(
"gc."
+
name
+
".count"
,
garbageCollectorMXBean
.
getCollectionCount
()));
result
.
add
(
new
Metric
<
Long
>(
"gc."
+
name
+
".time"
,
garbageCollectorMXBean
.
getCollectionTime
()));
}
}
...
...
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