Class ManagementService
java.lang.Object
com.linecorp.armeria.server.AbstractHttpService
com.linecorp.armeria.server.management.ManagementService
- All Implemented Interfaces:
Unwrappable
,HttpService
,Service<HttpRequest,
HttpResponse>
An
HttpService
that provides monitoring and management features.
First, you need to bind a ManagementService
under a path.
Server.builder()
.serviceUnder("/internal/management/", ManagementService.of())
Thread dump
You can dump the thread information for all live threads with stack trace by accessing"/jvm/threaddump"
.
If MediaType.JSON
is specified in HttpHeaderNames.ACCEPT
, the thread information will be
converted to a JSON. Otherwise, the thread dump will be converted to a plain text.
// Exports thread information as a JSON array
curl -L -H "Accept: application/json" http://my-service.com/internal/management/jvm/threaddump
// Exports thread information as a plain text
curl -L -H "Accept: text/plain" http://my-service.com/internal/management/jvm/threaddump
Heap dump
You can also dump the heap in the same format as the hprof heap dump by accessing"/jvm/heapdump"
.
curl -L http://my-service.com/internal/management/jvm/heapdump -o heapdump.hprof
// Dump only live objects that are reachable from others
curl -L http://my-service.com/internal/management/jvm/heapdump?live=true -o heapdump.hprof
-
Method Summary
Modifier and TypeMethodDescriptiondoGet
(ServiceRequestContext ctx, HttpRequest req) Handles aGET
request.static ManagementService
of()
Returns a singletonManagementService
.Methods inherited from class com.linecorp.armeria.server.AbstractHttpService
doConnect, doDelete, doHead, doOptions, doPatch, doPost, doPut, doTrace, serve
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.server.HttpService
decorate, decorate, exchangeType, options
Methods inherited from interface com.linecorp.armeria.server.Service
as, serviceAdded, shouldCachePath, unwrap
Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable
equalsIgnoreWrapper, unwrapAll
-
Method Details
-
of
Returns a singletonManagementService
. -
doGet
Description copied from class:AbstractHttpService
Handles aGET
request. This method sends a405 Method Not Allowed
response by default.- Overrides:
doGet
in classAbstractHttpService
- Throws:
Exception
-