No description
Find a file
2024-07-05 15:11:11 +02:00
agent bugfix when read_pos==capacity 2024-07-05 15:11:11 +02:00
api bugfix when read_pos==capacity 2024-07-05 15:11:11 +02:00
rustlib bugfix when read_pos==capacity 2024-07-05 15:11:11 +02:00
.gitignore stil WIP 2024-06-20 20:55:42 +02:00
pom.xml improved project structure, no more hardcoded absolute path for bootstrap lib in agent 2024-07-03 15:59:12 +02:00
README.md improved project structure, no more hardcoded absolute path for bootstrap lib in agent 2024-07-03 15:59:12 +02:00

Experiment with java22 and Rust to monitor exceptions in a JVM

  • It's a mini APM that leverages the java22 ClassFile API and java22 Foreign Function Interface.
  • It's a java agent that instruments all throw opcodes in your bytecode with a call to a logger written in Rust.

Work in Progress. Proof of concept works, but needs optimization. Try this at home, not at work :)

Running:

  • Update the path to the rust lib (temp fix) in ExceptionLogger for your setup
  • mvn clean install #maven also takes care of cargo
  • create a minimal class in a separate project
public class Main {
    public static void main(String[] args) throws Throwable {
        throw new Throwable();
    }
}

Requirements

  • java22
  • rust

Start rest service

cd api; RUST_LOG=info cargo run

Start your java with

java22 -javaagent:$EXCEPTIONAL_PROJECT/exceptional/agent/target/exceptional-agent-1.0-SNAPSHOT.jar 
-Dagentlib="$EXCEPTIONAL_PROJECT/rustlib/target/release/librustlib.dylib"
--enable-preview --enable-native-access=ALL-UNNAMED 
-classpath $YOUR_CLASSPATH YourMain