# Build the generator
go build -o bin/generate-java-methods cmd/javaanalyzer/main.go
# Run the generator with path to Java services
./bin/generate-java-methods --services /path/to/java/services
This will generate a file in internal/javaclassmethods/javaclassmethods.go with all method information.
Analyzing service endpoint
go run cmd/clickhouseanalyzer/main.go --host=10.10.10.58 --username=default --password=password
This will generate a file in internal/serviceendpoints/serviceendpoints.go with all service endpoint information. And a file in internal/databaseoperations/databaseoperations.go with all database operation information.
appName := "ts-user-service"
// Get a dynamic method by index
controllers.CreateJVMChaos(k8sClient, namespace, appName,
chaosmeshv1alpha1.JVMLatencyAction, pointer.String("2m"),
chaos.WithJVMClass("com.example.UserService"),
chaos.WithJVMMethod("getUserById"),
chaos.WithJVMLatencyDuration(1000))
The package provides an API to access extracted Java method information:
// Get all methods for a service name
methods := handler.GetJVMMethods("user-service")
// Get all services names
serviceNames := handler.ListJVMServiceNames()
// Get methods for a specific app
methods := handler.GetJVMMethodsForApp("ts-user-service")
Internal Data Generator
Analyzing Java Services
This will generate a file in
internal/javaclassmethods/javaclassmethods.go
with all method information.Analyzing service endpoint
This will generate a file in
internal/serviceendpoints/serviceendpoints.go
with all service endpoint information. And a file ininternal/databaseoperations/databaseoperations.go
with all database operation information.Example
Set the namespace and appList to inject chaos
Single chaos
NetworkChaos
DNSChaos
JVM Chaos
JVM Latency Injection
JVM Exception Injection
JVM MySQL Latency
Schedule chaos
workflow
JVM Method Extraction API
The package provides an API to access extracted Java method information: