Skip to content

Commit 60868c4

Browse files
committed
docs
1 parent 79d8f5f commit 60868c4

File tree

1 file changed

+57
-25
lines changed

1 file changed

+57
-25
lines changed

README.md

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Java Code Tracer (JCT) [![Maven Tests](https://github.com/niesfisch/java-code-tracer/actions/workflows/maven-tests.yml/badge.svg)](https://github.com/niesfisch/java-code-tracer/actions/workflows/maven-tests.yml)
22

3-
JCT is a Java agent that instruments method calls at runtime and records executed call stacks.
4-
It helps answer one practical question in large systems: "Is this code path still used in real traffic?"
3+
JCT is a Java agent that records real method call stacks while your application is running.
4+
5+
If you work in a legacy app and ask things like "Can we remove this?" or "Is this code path still hit in production-like traffic?", JCT gives you hard runtime evidence instead of guesses.
56

67
## Table of Contents
78

8-
- [What JCT Does](#what-jct-does)
9+
- [Why This Is Useful in Legacy Systems](#why-this-is-useful-in-legacy-systems)
10+
- [What JCT Does at Runtime](#what-jct-does-at-runtime)
11+
- [Quick Start in 3 Steps](#quick-start-in-3-steps)
912
- [Recommended Local Workflow: ELK](#recommended-local-workflow-elk)
1013
- [Project Status](#project-status)
1114
- [Java Version](#java-version)
@@ -19,33 +22,68 @@ It helps answer one practical question in large systems: "Is this code path stil
1922
- [Tools](#tools)
2023
- [ELK Integration Guide](#elk-integration-guide)
2124
- [Similar Projects](#similar-projects)
25+
- [IntelliJ JVM Options Example](#intellij-jvm-options-example)
2226
- [License](#license)
2327

24-
## What JCT Does
28+
## Why This Is Useful in Legacy Systems
29+
30+
In older monoliths and large shared platforms, static code search is usually not enough.
31+
32+
- Feature flags, reflection, and framework magic hide real call paths
33+
- "Unused" code often turns out to be used by one weird but critical flow
34+
- Refactoring without runtime traces is risky and slow
35+
36+
JCT helps you reduce that risk by showing what was actually executed.
37+
38+
## What JCT Does at Runtime
39+
40+
When you attach JCT via `-javaagent`, it does this:
41+
42+
1. Instruments methods that match your include/exclude config
43+
2. Captures call stacks during real execution
44+
3. Sends stack events to a processor (file, UDP or TCP)
45+
4. Lets you inspect those events to validate or reject assumptions
2546

26-
- Instruments selected classes and methods via `-javaagent`
27-
- Captures call stacks and timestamps at runtime
28-
- Supports multiple output processors (file and UDP)
29-
- Lets you analyze runtime behavior without changing app code
47+
This is especially useful before deleting legacy code, splitting modules, or tightening APIs.
48+
49+
## Quick Start in 3 Steps
50+
51+
If you just want first results quickly:
52+
53+
1. Build JCT
54+
2. Start your app with `-javaagent` and a config
55+
3. Inspect generated events (file output or ELK stack)
56+
57+
Minimum commands:
58+
59+
```bash
60+
mvn clean package
61+
mkdir -p "$HOME/.jct"
62+
cp doc/config-sample-file.yaml "$HOME/.jct/config-sample-file.yaml"
63+
java \
64+
-javaagent:"${PWD}/target/java-code-tracer-1.0-SNAPSHOT-jar-with-dependencies.jar" \
65+
-Djct.config="$HOME/.jct/config-sample-file.yaml" \
66+
-Djct.logDir=/tmp/jct \
67+
-noverify \
68+
-jar /path/to/your-application.jar
69+
```
70+
71+
Then check `/tmp/jct` logs and your configured processor output.
3072

3173
## Recommended Local Workflow: ELK
3274

3375
For local experimentation, the recommended setup is:
3476

3577
```
36-
-javaagent:jct.jar Docker Compose
37-
┌─────────────────┐ ┌───────────────────────────────────┐
38-
│ JCT Agent │ │ Logstash :9999 │
39-
│ Recorder │────▶│ │ │
40-
│ Stack │ │ ▼ │
41-
│ Processor │ │ Elasticsearch (jct-events-*) │
42-
│ UDP / TCP │ │ │ │
43-
└─────────────────┘ │ ▼ │
44-
│ Kibana :5601 │
45-
└───────────────────────────────────┘
78+
-javaagent:jct.jar docker compose up
79+
+-------------------+ +-----------------------------------+
80+
| App + JCT Agent | | Logstash :9999 |
81+
| Recorder/Processor|----->| -> Elasticsearch (jct-events-*)|
82+
+-------------------+ | -> Kibana :5601 |
83+
+-----------------------------------+
4684
```
4785

48-
This gives you a fast feedback loop with searchable traces and a UI for exploration.
86+
This gives you a fast feedback loop: run traffic, query traces, validate code paths.
4987

5088
Start here:
5189

@@ -208,9 +246,3 @@ Use the following IntelliJ Run/Debug VM options example when attaching JCT as a
208246

209247
[MIT](LICENSE.txt)
210248

211-
# For me :)
212-
213-
```bash
214-
GIT_SSH_COMMAND='ssh -i ~/.ssh/niesfisch' git pull
215-
GIT_SSH_COMMAND='ssh -i ~/.ssh/niesfisch' git push
216-
```

0 commit comments

Comments
 (0)