Make Actuator Web API documentation compatible with Java 9

Closes gh-8042
pull/11066/head
Andy Wilkinson 7 years ago
parent 3fb86b261e
commit 3b45342359

@ -74,7 +74,7 @@ using the `tag` query parameter, as shown in the following curl-based example:
include::{snippets}metrics/metric-with-tags/curl-request.adoc[] include::{snippets}metrics/metric-with-tags/curl-request.adoc[]
The preceding example retrieves the `jvm.memory.max` metric, where the `area` tag has a The preceding example retrieves the `jvm.memory.max` metric, where the `area` tag has a
value of `nonheap` and the `id` attribute has a value of `Code Cache`. The resulting value of `nonheap` and the `id` attribute has a value of `Compressed Class Space`. The
response is similar to the following: resulting response is similar to the following:
include::{snippets}metrics/metric-with-tags/http-response.adoc[] include::{snippets}metrics/metric-with-tags/http-response.adoc[]

@ -75,7 +75,8 @@ public class MetricsEndpointDocumentationTests
public void metricWithTags() throws Exception { public void metricWithTags() throws Exception {
this.mockMvc this.mockMvc
.perform(get("/application/metrics/jvm.memory.max") .perform(get("/application/metrics/jvm.memory.max")
.param("tag", "area:nonheap").param("tag", "id:Code Cache")) .param("tag", "area:nonheap")
.param("tag", "id:Compressed Class Space"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andDo(document("metrics/metric-with-tags", .andDo(document("metrics/metric-with-tags",
requestParameters(parameterWithName("tag").description( requestParameters(parameterWithName("tag").description(

@ -47,69 +47,38 @@ public class ThreadDumpEndpointDocumentationTests
preprocessResponse(limit("threads")), preprocessResponse(limit("threads")),
responseFields( responseFields(
fieldWithPath("threads").description("JVM's threads."), fieldWithPath("threads").description("JVM's threads."),
fieldWithPath("threads.[].threadName")
.description("Name of the thread."),
fieldWithPath("threads.[].threadId")
.description("ID of the thread."),
fieldWithPath("threads.[].blockedTime").description(
"Time in milliseconds that the thread has spent "
+ "blocked. -1 if thread contention "
+ "monitoring is disabled."),
fieldWithPath("threads.[].blockedCount").description( fieldWithPath("threads.[].blockedCount").description(
"Total number of times that the thread has been " "Total number of times that the thread has been "
+ "blocked."), + "blocked."),
fieldWithPath("threads.[].waitedTime").description( fieldWithPath("threads.[].blockedTime").description(
"Time in milliseconds that the thread has spent " "Time in milliseconds that the thread has spent "
+ "waiting. -1 if thread contention " + "blocked. -1 if thread contention "
+ "monitoring is disabled"), + "monitoring is disabled."),
fieldWithPath("threads.[].waitedCount").description( fieldWithPath("threads.[].daemon")
"Total number of times that the thread has waited" .description("Whether the thread is a daemon "
+ " for notification."), + "thread. Only available on Java 9 or "
+ "later.")
.optional().type(JsonFieldType.BOOLEAN),
fieldWithPath("threads.[].inNative").description(
"Whether the thread is executing native code."),
fieldWithPath("threads.[].lockName") fieldWithPath("threads.[].lockName")
.description( .description(
"Description of the object on which the " "Description of the object on which the "
+ "thread is blocked, if any.") + "thread is blocked, if any.")
.optional(), .optional(),
fieldWithPath("threads.[].lockOwnerId").description( fieldWithPath("threads.[].lockInfo").description(
"ID of the thread that owns the object on which " "Object for which the thread is blocked "
+ "the thread is blocked. `-1` if the " + "waiting.")
+ "thread is not blocked."),
fieldWithPath("threads.[].lockOwnerName")
.description(
"Name of the thread that owns the object "
+ "on which the thread is blocked.")
.optional(), .optional(),
fieldWithPath("threads.[].inNative").description( fieldWithPath("threads.[].lockInfo.className")
"Whether the thread is executing native code."),
fieldWithPath("threads.[].suspended")
.description("Whether the thread is suspended."),
fieldWithPath("threads.[].threadState")
.description("State of the thread ("
+ describeEnumValues(Thread.State.class)
+ ")."),
fieldWithPath("threads.[].stackTrace")
.description("Stack trace of the thread."),
fieldWithPath("threads.[].stackTrace.[].methodName")
.description("Name of the method."),
fieldWithPath("threads.[].stackTrace.[].fileName")
.description(
"Name of the source file that contains "
+ "the execution point identified "
+ "by this entry, if any.")
.optional().type(JsonFieldType.STRING),
fieldWithPath("threads.[].stackTrace.[].lineNumber")
.description("Line number of the execution point "
+ "identified by this entry. Negative"
+ " if unknown."),
fieldWithPath("threads.[].stackTrace.[].className")
.description( .description(
"Name of the class that contains the " "Fully qualified class name of the lock"
+ "execution point identified " + " object.")
+ "by this entry."), .optional(),
fieldWithPath("threads.[].stackTrace.[].nativeMethod") fieldWithPath("threads.[].lockInfo.identityHashCode")
.description( .description(
"Whether the execution point is a native " "Identity hash code of the lock object.")
+ "method."), .optional(),
fieldWithPath("threads.[].lockedMonitors").description( fieldWithPath("threads.[].lockedMonitors").description(
"Monitors locked by this thread, if any"), "Monitors locked by this thread, if any"),
fieldWithPath("threads.[].lockedMonitors.[].className") fieldWithPath("threads.[].lockedMonitors.[].className")
@ -147,19 +116,77 @@ public class ThreadDumpEndpointDocumentationTests
"Identity hash code of the locked " "Identity hash code of the locked "
+ "synchronizer.") + "synchronizer.")
.optional().type(JsonFieldType.NUMBER), .optional().type(JsonFieldType.NUMBER),
fieldWithPath("threads.[].lockInfo").description( fieldWithPath("threads.[].lockOwnerId").description(
"Object for which the thread is blocked " "ID of the thread that owns the object on which "
+ "waiting.") + "the thread is blocked. `-1` if the "
+ "thread is not blocked."),
fieldWithPath("threads.[].lockOwnerName")
.description("Name of the thread that owns the "
+ "object on which the thread is "
+ "blocked.")
.optional(), .optional(),
fieldWithPath("threads.[].lockInfo.className") fieldWithPath("threads.[].priority")
.description("Priority of the thread. Only "
+ "available on Java 9 or later.")
.optional().type(JsonFieldType.NUMBER),
fieldWithPath("threads.[].stackTrace")
.description("Stack trace of the thread."),
fieldWithPath("threads.[].stackTrace.[].classLoaderName")
.description("Name of the class loader of the "
+ "class that contains the execution "
+ "point identified by this entry, if "
+ "any. Only available on Java 9 or "
+ "later.")
.optional().type(JsonFieldType.STRING),
fieldWithPath("threads.[].stackTrace.[].className")
.description( .description(
"Fully qualified class name of the lock" "Name of the class that contains the "
+ " object.") + "execution point identified "
.optional(), + "by this entry."),
fieldWithPath("threads.[].lockInfo.identityHashCode") fieldWithPath("threads.[].stackTrace.[].fileName")
.description("Name of the source file that "
+ "contains the execution point "
+ "identified by this entry, if any.")
.optional().type(JsonFieldType.STRING),
fieldWithPath("threads.[].stackTrace.[].lineNumber")
.description("Line number of the execution "
+ "point identified by this entry. "
+ "Negative if unknown."),
fieldWithPath("threads.[].stackTrace.[].methodName")
.description("Name of the method."),
fieldWithPath("threads.[].stackTrace.[].moduleName")
.description("Name of the module that contains "
+ "the execution point identified by "
+ "this entry, if any. Only available "
+ "on Java 9 or later.")
.optional().type(JsonFieldType.STRING),
fieldWithPath("threads.[].stackTrace.[].moduleVersion")
.description("Version of the module that "
+ "contains the execution point "
+ "identified by this entry, if any. "
+ "Only available on Java 9 or later.")
.optional().type(JsonFieldType.STRING),
fieldWithPath("threads.[].stackTrace.[].nativeMethod")
.description( .description(
"Identity hash code of the lock object.") "Whether the execution point is a native "
.optional()))); + "method."),
fieldWithPath("threads.[].suspended")
.description("Whether the thread is suspended."),
fieldWithPath("threads.[].threadId")
.description("ID of the thread."),
fieldWithPath("threads.[].threadName")
.description("Name of the thread."),
fieldWithPath("threads.[].threadState")
.description("State of the thread ("
+ describeEnumValues(Thread.State.class)
+ ")."),
fieldWithPath("threads.[].waitedCount").description(
"Total number of times that the thread has waited"
+ " for notification."),
fieldWithPath("threads.[].waitedTime").description(
"Time in milliseconds that the thread has spent "
+ "waiting. -1 if thread contention "
+ "monitoring is disabled"))));
} }
@Configuration @Configuration

Loading…
Cancel
Save