-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev UI - add basic monitoring of CDI components
- by default, fired events and business method invocations are monitored - quarkus.arc.dev-mode-monitoring=false disables the feature
- Loading branch information
Showing
21 changed files
with
854 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcDevModeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.quarkus.arc.deployment; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
|
||
@ConfigGroup | ||
public class ArcDevModeConfig { | ||
|
||
/** | ||
* If set to true then the container monitors business method invocations and fired events during the development mode. | ||
*/ | ||
@ConfigItem(defaultValue = "true") | ||
public boolean monitoringEnabled; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 14 additions & 4 deletions
18
extensions/arc/deployment/src/main/resources/dev-templates/embedded.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
<a href="{urlbase}/beans" class="badge badge-light"> | ||
<i class="fa fa-egg fa-fw"></i> | ||
Beans <span class="badge badge-light">{info:devBeanInfos.beans.size()}</span></a> | ||
Beans <span class="badge badge-light">{info:devBeanInfos.beans.size}</span></a> | ||
<br> | ||
<a href="{urlbase}/observers" class="badge badge-light"> | ||
<i class="fa fa-eye fa-fw"></i> | ||
Observers <span class="badge badge-light">{info:arcContainer.observers.size()}</span></a> | ||
Observers <span class="badge badge-light">{info:arcContainer.observers.size}</span></a> | ||
<br> | ||
{#if config:property('quarkus.arc.dev-mode.monitoring-enabled') is "true"} | ||
<a href="{urlbase}/events" class="badge badge-light"> | ||
<i class="far fa-eye"></i> | ||
Fired Events</a> | ||
<br> | ||
<a href="{urlbase}/invocations" class="badge badge-light"> | ||
<i class="fas fa-project-diagram"></i> | ||
Invocation Trees</a> | ||
<br> | ||
{/if} | ||
<a href="{urlbase}/removed-beans" class="badge badge-light"> | ||
<i class="fa fa-trash-alt fa-fw"></i> | ||
Removed Beans <span class="badge badge-light">{info:arcContainer.removedBeans.size()}</span></a> | ||
Removed Beans <span class="badge badge-light">{info:arcContainer.removedBeans.size}</span></a> | ||
<br> | ||
<span class="badge badge-light"> | ||
<i class="fa fa-traffic-light fa-fw"></i> | ||
Interceptors <span class="badge badge-light">{info:arcContainer.interceptors.size()}</span></span> | ||
Interceptors <span class="badge badge-light">{info:arcContainer.interceptors.size}</span></span> |
63 changes: 63 additions & 0 deletions
63
extensions/arc/deployment/src/main/resources/dev-templates/events.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{#include main fluid=true} | ||
{#style} | ||
.nav-item { | ||
padding: .5rem .3rem; | ||
} | ||
{/style} | ||
{#title}Fired Events{/title} | ||
{#body} | ||
<ul class="nav"> | ||
<li class="nav-item"> | ||
<input id="clear" type="submit" class="btn btn-primary btn-sm" value="Refresh" | ||
onClick="window.location.reload();"> | ||
</li> | ||
<li class="nav-item"> | ||
<form method="post" enctype="application/x-www-form-urlencoded" class="form-inline"> | ||
<input id="clear" type="submit" class="btn btn-primary btn-sm" value="Clear"> | ||
</form> | ||
</li> | ||
<li class="nav-item"> | ||
<form method="post" enctype="application/x-www-form-urlencoded" class="form-inline"> | ||
<input id="skipContextsCheck" type="checkbox" class="form-check-input" disabled{#if info:eventsMonitor.skipContextEvents} checked{/if}> | ||
<label for="skipContextsCheck">Skip context lifecycle events</label> | ||
<input type="hidden" name="action" value="skipContext"> | ||
| ||
<input id="toggle" type="submit" class="btn btn-primary btn-sm" value="Toggle"> | ||
</form> | ||
</li> | ||
</ul> | ||
<table class="table table-striped"> | ||
<thead class="thead-dark"> | ||
<tr> | ||
<th scope="col">Timestamp <i class="fas fa-caret-down"></i></th> | ||
<th scope="col">Event Type</th> | ||
<th scope="col">Qualifiers</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{#for event in info:eventsMonitor.lastEvents.orEmpty} | ||
<tr> | ||
<td> | ||
{event.timestamp} | ||
</td> | ||
<td> | ||
<code>{event.type}</code> | ||
</td> | ||
<td> | ||
{#when event.qualifiers.size} | ||
{#is 1} | ||
<code>{event.qualifiers.iterator.next}</code> | ||
{#is > 1} | ||
<ul> | ||
{#for q in event.qualifiers} | ||
<li>{q}</li> | ||
{/for} | ||
</ul> | ||
{/when} | ||
</td> | ||
</tr> | ||
{/for} | ||
</tbody> | ||
</table> | ||
{/body} | ||
{/include} |
85 changes: 85 additions & 0 deletions
85
extensions/arc/deployment/src/main/resources/dev-templates/invocations.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{#include main fluid=true} | ||
{#style} | ||
.nav-item { | ||
padding: .5rem .3rem; | ||
} | ||
ul#tree, ul.nested { | ||
list-style-type: none; | ||
} | ||
#tree { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
span.caret { | ||
cursor: pointer; | ||
user-select: none; | ||
} | ||
span.caret::before { | ||
content: "\229E"; | ||
color: black; | ||
display: inline-block; | ||
margin-right: 6px; | ||
} | ||
span.caret-down::before { | ||
content: "\229F" | ||
/*transform: rotate(90deg);*/ | ||
} | ||
ul.nested { | ||
display: none; | ||
} | ||
ul.active { | ||
display: block; | ||
} | ||
ul code { | ||
color: #343a40; | ||
} | ||
{/style} | ||
{#script} | ||
var carets = document.getElementsByClassName("caret"); | ||
for (i = 0; i < carets.length; i++) { | ||
carets[i].addEventListener("click", function() { | ||
this.parentElement.querySelector(".nested").classList.toggle("active"); | ||
this.classList.toggle("caret-down"); | ||
}); | ||
} | ||
{/script} | ||
{#title}Invocation Trees{/title} | ||
{#body} | ||
<ul class="nav"> | ||
<li class="nav-item"> | ||
<input type="submit" class="btn btn-primary btn-sm" value="Refresh" | ||
onClick="window.location.reload();"> | ||
</li> | ||
<li class="nav-item"> | ||
<form method="post" enctype="application/x-www-form-urlencoded" class="form-inline"> | ||
<button type="submit" class="btn btn-primary btn-sm">Clear</button> | ||
</form> | ||
</li> | ||
<li class="nav-item"> | ||
<form method="post" enctype="application/x-www-form-urlencoded" class="form-inline"> | ||
<input id="filterOutQuarkusBeans" type="checkbox" class="form-check-input" disabled{#if info:invocationsMonitor.filterOutQuarkusBeans} checked{/if}> | ||
<label for="filterOutQuarkusBeans">Filter out Quarkus beans</label> | ||
<input type="hidden" name="action" value="filterOutQuarkusBeans"> | ||
| ||
<input id="toggle" type="submit" class="btn btn-primary btn-sm" value="Toggle"> | ||
</form> | ||
</li> | ||
</ul> | ||
<table class="table table-striped"> | ||
<thead class="thead-dark"> | ||
<tr> | ||
<th scope="col">Start <i class="fas fa-caret-down"></i></th> | ||
<th scope="col" style="width:80%;">Invocations</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{#each info:invocationsMonitor.lastInvocations.orEmpty} | ||
<tr> | ||
<td>{it.startFormatted}</td> | ||
<td><ul id="tree">{#tree it root=true /}</ul></td> | ||
</tr> | ||
{/each} | ||
</tbody> | ||
</table> | ||
{/body} | ||
{/include} |
3 changes: 3 additions & 0 deletions
3
extensions/arc/deployment/src/main/resources/dev-templates/tags/duration.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="badge badge-info"{#if it.durationMillis le 0} title="{it.duration} ns"{/if}> | ||
{#if it.durationMillis > 0}{it.durationMillis} ms{#else}< 1 ms{/if} | ||
</span> |
8 changes: 8 additions & 0 deletions
8
extensions/arc/deployment/src/main/resources/dev-templates/tags/kind.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{#when it.kind} | ||
{#is PRODUCER} | ||
<span class="badge badge-success">Producer</span> | ||
{#is DISPOSER} | ||
<span class="badge badge-warning">Disposer</span> | ||
{#is OBSERVER} | ||
<span class="badge badge-secondary">Observer</span> | ||
{/when} |
15 changes: 15 additions & 0 deletions
15
extensions/arc/deployment/src/main/resources/dev-templates/tags/tree.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<li> | ||
{#if !root} | ||
{#if next}├─{#else}└─{/if} | ||
{/if} | ||
{#if it.children} | ||
<span class="caret" title="{it.method}"><code>{it.methodInfo}</code></span> {#duration it /}{#kind it /}{#if it.message != null} <span class="badge badge-danger" title="Exception message: {it.message}">Error</span>{/if} | ||
<ul class="nested"> | ||
{#each it.children} | ||
{#tree it root=false next=hasNext /} | ||
{/each} | ||
</ul> | ||
{#else} | ||
<span title="{it.method}"><code>{it.methodInfo}</code></span> {#duration it /}{#kind it /}{#if it.message != null} <span class="badge badge-danger" title="Exception message: {it.message}">Error</span>{/if} | ||
{/if} | ||
</li> |
Oops, something went wrong.