# barosl/jvm-monitor architecture

> Architecture diagram of the GitHub repository barosl/jvm-monitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/barosl/jvm-monitor
- Repository: https://github.com/barosl/jvm-monitor

## Overview

jvm-monitor is a Java-agent debugger-like monitor: the JVM reports exception events, and the agent records exception details and locals across stack frames. A separate Python step parses that log into JSON, which the FastAPI viewer loads and presents. The README documents class filters and manual exceptions for non-exception error cases. Agent callback internals and template details are only partially sampled, so the graph shows documented behavior without asserting unverified internal calls.

Main entry points: [`web.py`](https://github.com/barosl/jvm-monitor/blob/master/web.py) (Viewer app), [`parse.py`](https://github.com/barosl/jvm-monitor/blob/master/parse.py) (Log parser), [`src/main.c`](https://github.com/barosl/jvm-monitor/blob/master/src/main.c) (JVMTI agent), [`tpls/index.html`](https://github.com/barosl/jvm-monitor/blob/master/tpls/index.html) (Log page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Java agent"]
  node_config["Agent config<br/>[cfg.txt]"]
  node_agent["JVMTI agent<br/>[main.c]"]
  node_exception_capture["Exception capture<br/>[main.c]"]
  node_stack_locals["Stack and locals<br/>[main.c]"]
end

subgraph group_processing["Log processing"]
  node_exception_log["Exception log"]
  node_parser["Log parser<br/>[parse.py]"]
  node_json_data[("Parsed log data")]
end

subgraph group_viewer["Web viewer"]
  node_web_app["Viewer app<br/>[web.py]"]
  node_template["Log page<br/>[index.html]"]
end

node_operator(("Operator"))
node_java_app["Java application<br/>[TestApp.java]"]
node_jvm["Java VM"]
node_browser(("Browser"))

node_operator -->|"starts"| node_jvm
node_java_app -->|"runs in"| node_jvm
node_operator -->|"configures"| node_config
node_jvm -->|"loads agent"| node_agent
node_agent -->|"reads"| node_config
node_jvm -->|"reports exceptions"| node_exception_capture
node_exception_capture -->|"captures frames"| node_stack_locals
node_stack_locals -->|"writes records"| node_exception_log
node_operator -->|"runs on log"| node_parser
node_exception_log -->|"reads"| node_parser
node_parser -->|"writes JSON"| node_json_data
node_operator -->|"launches"| node_web_app
node_web_app -->|"loads"| node_json_data
node_browser -->|"requests page"| node_web_app
node_web_app -->|"renders"| node_template
node_template -->|"returns page"| node_browser

click node_java_app "https://github.com/barosl/jvm-monitor/blob/master/TestApp/TestApp.java"
click node_config "https://github.com/barosl/jvm-monitor/blob/master/cfg.txt"
click node_agent "https://github.com/barosl/jvm-monitor/blob/master/src/main.c"
click node_exception_capture "https://github.com/barosl/jvm-monitor/blob/master/src/main.c"
click node_stack_locals "https://github.com/barosl/jvm-monitor/blob/master/src/main.c"
click node_parser "https://github.com/barosl/jvm-monitor/blob/master/parse.py"
click node_web_app "https://github.com/barosl/jvm-monitor/blob/master/web.py"
click node_template "https://github.com/barosl/jvm-monitor/blob/master/tpls/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_agent,node_exception_capture,node_stack_locals,node_browser toneBlue
class node_exception_log,node_parser,node_json_data toneAmber
class node_web_app,node_template toneMint
class node_operator,node_jvm toneIndigo
class node_java_app toneTeal
```

## Components

### Java agent

- [Agent config](https://github.com/barosl/jvm-monitor/blob/master/cfg.txt): `cfg.txt`
- [JVMTI agent](https://github.com/barosl/jvm-monitor/blob/master/src/main.c): `src/main.c`
- [Exception capture](https://github.com/barosl/jvm-monitor/blob/master/src/main.c): `src/main.c`
- [Stack and locals](https://github.com/barosl/jvm-monitor/blob/master/src/main.c): `src/main.c`

### Log processing

- **Exception log**
- [Log parser](https://github.com/barosl/jvm-monitor/blob/master/parse.py): `parse.py`
- **Parsed log data**

### Web viewer

- [Viewer app](https://github.com/barosl/jvm-monitor/blob/master/web.py): `web.py`
- [Log page](https://github.com/barosl/jvm-monitor/blob/master/tpls/index.html): `tpls/index.html`

### Other components

- **Operator**
- [Java application](https://github.com/barosl/jvm-monitor/blob/master/TestApp/TestApp.java): `TestApp/TestApp.java`
- **Java VM**
- **Browser**

## Connections

- Operator → Java VM: starts
- Java application → Java VM: runs in
- Operator → Agent config: configures
- Java VM → JVMTI agent: loads agent
- JVMTI agent → Agent config: reads
- Java VM → Exception capture: reports exceptions
- Exception capture → Stack and locals: captures frames
- Stack and locals → Exception log: writes records
- Operator → Log parser: runs on log
- Exception log → Log parser: reads
- Log parser → Parsed log data: writes JSON
- Operator → Viewer app: launches
- Viewer app → Parsed log data: loads
- Browser → Viewer app: requests page
- Viewer app → Log page: renders
- Log page → Browser: returns page
