EH Monitor
Real-time cache monitoring for EHCache and Caffeine, right inside VS Code. Connect via JMX or point it at an HTTP endpoint and get a live dashboard with charts, alerts, and diagnostics.
What you get
- Live dashboard with hit/miss, size, latency charts and a hit ratio gauge
- Works with EHCache 2.x, 3.x, and Caffeine
- Three monitoring modes: JMX, JSON endpoint, or regex-mapped endpoint
- Anomaly alerts (low hit ratio, eviction spikes, latency spikes, and more)
- Configurable time intervals (1s, 1m, 5m, 15m, 1h) and chart display points
- Toggle alerts on/off from the dashboard, clear and restart without losing your connection
Quick start
JMX (default)
You need a JDK 11+ on the machine running VS Code. The extension handles the rest.
- Start your Java app with JMX enabled:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
- Run EH Monitor: Show Dashboard from the command palette
- That's it. If
java isn't on your PATH, set ehMonitor.jmx.javaPath
HTTP endpoint
Set ehMonitor.mode to "custom" and ehMonitor.endpoint.url to a URL that returns JSON like:
{
"myCache": { "hits": 100, "misses": 20, "size": 50 }
}
Regex mapping
For non-standard endpoints, set ehMonitor.mode to "mapped" and define ehMonitor.endpoint.mapping:
{
"hitCount": "hits=(\\d+)",
"missCount": "misses=(\\d+)"
}
Commands
| Command |
What it does |
| Show Dashboard |
Opens the chart dashboard and starts monitoring |
| Start / Stop Monitoring |
Control the polling loop |
| Refresh Cache List |
Force a poll and reconnect if needed |
| JMX Diagnostics |
Dump MBean domains, cache beans, and raw attributes |
| Configure Settings |
Interactive wizard for mode, host, port, and interval |
Settings
Connection
| Setting |
Default |
Description |
ehMonitor.cacheProvider |
ehcache |
ehcache or caffeine |
ehMonitor.mode |
jmx |
jmx, custom, or mapped |
ehMonitor.jmx.host |
localhost |
JMX host |
ehMonitor.jmx.port |
9999 |
JMX port |
ehMonitor.jmx.javaPath |
"" |
Path to java (auto-detected if empty) |
ehMonitor.jmx.javaOpts |
"" |
JVM flags for the bridge process (e.g. -Xmx512m) |
ehMonitor.jmx.maxBufferSizeMB |
10 |
Max bridge stdout buffer before kill (1-100 MB) |
ehMonitor.endpoint.url |
"" |
HTTP endpoint for custom/mapped mode |
ehMonitor.endpoint.mapping |
{} |
Field-to-regex map for mapped mode |
Dashboard
| Setting |
Default |
Description |
ehMonitor.pollInterval |
2000 |
Poll interval in ms |
ehMonitor.cacheFilter |
[] |
Only show these caches (empty = all) |
ehMonitor.chartDisplayPoints |
60 |
Data points per chart (10-500) |
Alerts
Alerts show as VS Code notifications and a banner in the dashboard. Toggle them from the dashboard or disable globally with ehMonitor.alerts.enabled.
| Setting |
Default |
Triggers when |
alerts.enabled |
true |
Master switch |
alerts.hitRatioMin |
0.5 |
Hit ratio drops below value |
alerts.evictionSpikePercent |
50 |
Evictions jump by more than X% between polls |
alerts.latencyMaxMs |
100 |
Avg get time exceeds threshold |
alerts.consecutiveMissPolls |
3 |
No new hits for N consecutive polls |
Cache-empty alerts fire automatically when a non-empty cache drops to size 0.
Override thresholds per project in .vscode/settings.json.
Resilience
- Monitoring auto-stops after 5 consecutive poll failures and tells you why
- JMX connection failures are caught cleanly; the dashboard stays open
- HTTP requests time out after 10 seconds instead of hanging forever
- Chart rendering errors are isolated so one broken chart doesn't take down the dashboard
Development
npm install
npm run build # compile + package VSIX
npm run compile # compile only (used by F5)
npm test # run tests
npm run package # compile + test + package VSIX
Press F5 in VS Code to launch the Extension Development Host.
JMX bridge JAR
The pre-built JAR targets Java 11. If the user's runtime doesn't match, the extension recompiles from source automatically. To rebuild manually:
javac --release 11 jmx-bridge/JmxBridge.java -d jmx-bridge/out
cd jmx-bridge/out && jar cfe ../../assets/jmx-bridge.jar JmxBridge JmxBridge.class