File tree Expand file tree Collapse file tree 2 files changed +14
-20
lines changed
src/main/java/com/rabbitmq/stream/perf Expand file tree Collapse file tree 2 files changed +14
-20
lines changed Original file line number Diff line number Diff line change @@ -46,17 +46,14 @@ public void configure(MonitoringContext context) {
4646 PlainTextThreadDumpFormatter formatter = new PlainTextThreadDumpFormatter ();
4747 context .addHttpEndpoint (
4848 "threaddump" ,
49- new HttpHandler () {
50- @ Override
51- public void handle (HttpExchange exchange ) throws IOException {
52- ThreadInfo [] threadInfos =
53- ManagementFactory .getThreadMXBean ().dumpAllThreads (true , true );
54- exchange .getResponseHeaders ().set ("Content-Type" , "text/plain" );
55- byte [] content = formatter .format (threadInfos ).getBytes (StandardCharsets .UTF_8 );
56- exchange .sendResponseHeaders (200 , content .length );
57- try (OutputStream out = exchange .getResponseBody ()) {
58- out .write (content );
59- }
49+ exchange -> {
50+ ThreadInfo [] threadInfos =
51+ ManagementFactory .getThreadMXBean ().dumpAllThreads (true , true );
52+ exchange .getResponseHeaders ().set ("Content-Type" , "text/plain" );
53+ byte [] content = formatter .format (threadInfos ).getBytes (StandardCharsets .UTF_8 );
54+ exchange .sendResponseHeaders (200 , content .length );
55+ try (OutputStream out = exchange .getResponseBody ()) {
56+ out .write (content );
6057 }
6158 });
6259 }
Original file line number Diff line number Diff line change @@ -39,15 +39,12 @@ public void configure(MonitoringContext context) {
3939 context .meterRegistry ().add (registry );
4040 context .addHttpEndpoint (
4141 "metrics" ,
42- new HttpHandler () {
43- @ Override
44- public void handle (HttpExchange exchange ) throws IOException {
45- exchange .getResponseHeaders ().set ("Content-Type" , "text/plain" );
46- byte [] content = registry .scrape ().getBytes (StandardCharsets .UTF_8 );
47- exchange .sendResponseHeaders (200 , content .length );
48- try (OutputStream out = exchange .getResponseBody ()) {
49- out .write (content );
50- }
42+ exchange -> {
43+ exchange .getResponseHeaders ().set ("Content-Type" , "text/plain" );
44+ byte [] content = registry .scrape ().getBytes (StandardCharsets .UTF_8 );
45+ exchange .sendResponseHeaders (200 , content .length );
46+ try (OutputStream out = exchange .getResponseBody ()) {
47+ out .write (content );
5148 }
5249 });
5350 }
You can’t perform that action at this time.
0 commit comments