Configuration
Configuration Reference
Section titled “Configuration Reference”Complete configuration guide for LeanJ components.
Agent Configuration
Section titled “Agent Configuration”Java Agent Arguments
Section titled “Java Agent Arguments”Add agent to JVM startup:
-javaagent:dist/agent/agent-core-1.0.0-SNAPSHOT.jar=package=com.myappParameters:
package=<package>- Package prefix to instrument (required)
Example:
-javaagent:agent.jar=package=com.exampleSystem Properties
Section titled “System Properties”Controller Connection
Section titled “Controller Connection”-Dprofiler.controller.host=localhost # Controller host (default: localhost)-Dprofiler.controller.port=9876 # Controller TCP port (default: 9876)-Dprofiler.controller.http.port=9877 # Controller HTTP port (default: 9877)Flush Interval
Section titled “Flush Interval”-Dprofiler.flush.interval.ms=1000 # Metrics flush interval in ms (default: 1000)Timer Source
Section titled “Timer Source”-Dprofiler.timer=wall # wall-clock time (default on Windows)-Dprofiler.timer=cpu # CPU timeNote: Windows defaults to wall for better stability.
Environment Variables
Section titled “Environment Variables”Docker Registration
Section titled “Docker Registration”LEANJ_PROJECT=my-service # Project name for identificationLEANJ_CONTROLLER_HOST=localhost # Controller hostLEANJ_CONTROLLER_PORT=9876 # Controller TCP portComplete Agent Configuration
Section titled “Complete Agent Configuration”VM Options:
-javaagent:dist/agent/agent-core-1.0.0-SNAPSHOT.jar=package=com.myapp-Dprofiler.controller.host=localhost-Dprofiler.controller.port=9876-Dprofiler.controller.http.port=9877-Dprofiler.flush.interval.ms=1000-Dprofiler.timer=wallDockerfile:
ENV JAVA_TOOL_OPTIONS="-javaagent:/agent/agent.jar=package=com.myapp"ENV LEANJ_PROJECT=my-serviceENV LEANJ_CONTROLLER_HOST=host.docker.internalENV LEANJ_CONTROLLER_PORT=9876Controller Configuration
Section titled “Controller Configuration”Default:
- TCP: 9876 (agent connections)
- HTTP: 9877 (CLI/IDE API)
Custom Ports:
CLI:
leanj controller start --port 8888# TCP: 8887, HTTP: 8888Environment Variable:
export LEANJ_CONTROLLER_PORT=8888leanj controller startManual:
java -jar controller.jar 8887 8888# TCP port, HTTP portResource Monitoring
Section titled “Resource Monitoring”System Property:
-Dprofiler.controller.resource.interval.seconds=10 # Monitoring interval (default: 10)CLI Configuration
Section titled “CLI Configuration”CLI Path
Section titled “CLI Path”System Property (for IDE):
-Dleanj.cli.path=/path/to/leanjEnvironment Variable:
export LEANJ_CLI_PATH=/usr/local/bin/leanjController Port
Section titled “Controller Port”Environment Variable:
export LEANJ_CONTROLLER_PORT=9877License Configuration
Section titled “License Configuration”API URL
Section titled “API URL”Environment Variable:
export LEANJ_LICENSE_API_URL=https://license-api.leanj.com/v1Default: Cloudflare Worker endpoint
Machine ID
Section titled “Machine ID”Environment Variable:
export LEANJ_MACHINE_ID=abc123Note: Auto-generated if not set. Used for license validation.
Development Mode
Section titled “Development Mode”Environment Variable:
export LEANJ_DEV_MODE=trueWarning: Only for testing. Do not use in production.
Checkout URL
Section titled “Checkout URL”Environment Variable:
export LEMON_SQUEEZY_CHECKOUT_URL=https://your-store.lemonsqueezy.com/checkout/buy/variant-idIntelliJ Plugin Configuration
Section titled “IntelliJ Plugin Configuration”CLI Path
Section titled “CLI Path”VM Options:
-Dleanj.cli.path=C:\tools\leanj.exeFile: Help → Edit Custom VM Options...
Controller Port
Section titled “Controller Port”Uses CLI configuration (environment variable or default).
Package Filtering
Section titled “Package Filtering”Single Package
Section titled “Single Package”-javaagent:agent.jar=package=com.myappMultiple Packages
Section titled “Multiple Packages”Currently, only one package prefix is supported. For multiple packages, use a common parent:
# Instead of: com.foo, com.bar# Use: com-javaagent:agent.jar=package=comPerformance Tuning
Section titled “Performance Tuning”Reduce Overhead
Section titled “Reduce Overhead”Increase flush interval:
-Dprofiler.flush.interval.ms=5000 # Flush every 5 seconds instead of 1Note: Lower frequency = less overhead but less real-time updates.
Increase Precision
Section titled “Increase Precision”Decrease flush interval:
-Dprofiler.flush.interval.ms=500 # Flush every 500msNote: Higher frequency = more overhead but more real-time updates.
Network Configuration
Section titled “Network Configuration”Docker Desktop (Mac/Windows)
Section titled “Docker Desktop (Mac/Windows)”ENV LEANJ_CONTROLLER_HOST=host.docker.internalOption 1: Host IP
ENV LEANJ_CONTROLLER_HOST=172.17.0.1Option 2: Shared Network Use Docker network or Kubernetes service name.
Kubernetes
Section titled “Kubernetes”env:- name: LEANJ_CONTROLLER_HOST value: "profiler-controller.default.svc.cluster.local"Configuration Files
Section titled “Configuration Files”License Storage
Section titled “License Storage”Location: ~/.leanj/license.json
Format:
{ "licenseKey": "abc123-def456", "tier": "pro", "expiresAt": "2025-12-31T23:59:59Z", "machineId": "xyz789"}Note: File is created automatically. Do not edit manually.
Controller PID File
Section titled “Controller PID File”Location: ~/.leanj/controller.pid
Note: Used for controller lifecycle management. Do not edit manually.
Configuration Examples
Section titled “Configuration Examples”Local Development
Section titled “Local Development”Run Configuration (IntelliJ):
VM options:-javaagent:dist/agent/agent-core-1.0.0-SNAPSHOT.jar=package=com.example-Dprofiler.controller.host=localhost-Dprofiler.controller.port=9876-Dprofiler.timer=wallDocker Development
Section titled “Docker Development”Dockerfile:
FROM openjdk:11-jre-slim
COPY agent-core-1.0.0-SNAPSHOT.jar /agent/agent.jar
ENV JAVA_TOOL_OPTIONS="-javaagent:/agent/agent.jar=package=com.myapp"ENV LEANJ_PROJECT=my-serviceENV LEANJ_CONTROLLER_HOST=host.docker.internalENV LEANJ_CONTROLLER_PORT=9876Production
Section titled “Production”Minimal overhead:
-javaagent:agent.jar=package=com.myapp-Dprofiler.flush.interval.ms=5000-Dprofiler.timer=cpuReal-time monitoring:
-javaagent:agent.jar=package=com.myapp-Dprofiler.flush.interval.ms=500-Dprofiler.timer=wallTroubleshooting
Section titled “Troubleshooting”Agent Not Connecting
Section titled “Agent Not Connecting”Check:
- Controller host/port configuration
- Network connectivity
- Firewall rules
- Controller logs
High Overhead
Section titled “High Overhead”Solutions:
- Increase flush interval
- Use CPU timer instead of wall-clock
- Narrow package filter
Configuration Not Applied
Section titled “Configuration Not Applied”Check:
- System properties format
- Environment variables set correctly
- JVM restarted (if needed)
- Configuration precedence
Next Steps
Section titled “Next Steps”- Learn about CLI commands
- Read How It Works
- See Troubleshooting Guide