From 35417622e69028bffde843706cc194cc9ac7081b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=A0=E6=B3=A2?= Date: Sat, 31 Oct 2015 00:26:38 +0800 Subject: [PATCH 1/2] Add thread total started count to SystemPublicMetrics See gh-4356 --- .../boot/actuate/endpoint/SystemPublicMetrics.java | 2 ++ .../boot/actuate/endpoint/SystemPublicMetricsTests.java | 1 + 2 files changed, 3 insertions(+) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java index 7e5f90f0c8..4713124287 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java @@ -119,6 +119,8 @@ public class SystemPublicMetrics implements PublicMetrics, Ordered { (long) threadMxBean.getPeakThreadCount())); result.add(new Metric("threads.daemon", (long) threadMxBean.getDaemonThreadCount())); + result.add(new Metric("threads.totalStarted", + threadMxBean.getTotalStartedThreadCount())); result.add(new Metric("threads", (long) threadMxBean.getThreadCount())); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java index 048db5c0d8..9c2ae63695 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java @@ -52,6 +52,7 @@ public class SystemPublicMetricsTests { assertTrue(results.containsKey("threads.peak")); assertTrue(results.containsKey("threads.daemon")); + assertTrue(results.containsKey("threads.totalStarted")); assertTrue(results.containsKey("threads")); assertTrue(results.containsKey("classes.loaded")); From bd8521c1abf7122d92ed6c5932b5102c175297a2 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 6 Nov 2015 09:24:08 +0100 Subject: [PATCH 2/2] Polish contribution Closes gh-4356 --- .../boot/actuate/endpoint/SystemPublicMetricsTests.java | 2 +- .../src/main/asciidoc/production-ready-features.adoc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java index 9c2ae63695..b1ae7c66fd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/SystemPublicMetricsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 6b256b36ba..2e9930b6dd 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -914,6 +914,7 @@ endpoint you should see a response similar to this: "threads": 15, "threads.daemon": 11, "threads.peak": 15, + "threads.totalStarted": 42, "uptime": 494836, "instance.uptime": 489782, "datasource.primary.active": 5,