Bazel processes¶
Daemonitor discovers and monitors Bazel-related JVM and native processes across macOS, Linux, and Windows, tracking persistent workers, test processes, and sandboxed descendant subtrees beneath each BAZEL_SERVER.
- Bazel Java: Java persistent workers (
JavaBuilder,VanillaJavaBuilder) and JVM test runners. - Bazel Kotlin:
rules_kotlin/KotlinBuilderpersistent workers and disambiguation from Gradle Kotlin daemons. - Bazel native processes: Swift/native workers, native test executables, and sandboxed compiler actions rolled into server subtrees.
Recognized process types¶
| Process type | Display label | Runtime | Role |
|---|---|---|---|
BAZEL_SERVER |
Bazel server | JVM |
Persistent Bazel server (A-server.jar with --product_name=Bazel or --output_base=) |
BAZEL_WORKER |
Bazel worker (toolchain-aware: Java worker, Kotlin worker, Swift worker) |
JVM, NATIVE, or UNKNOWN |
Persistent worker (--persistent_worker + Bazel worker marker) |
BAZEL_TEST |
Bazel test | JVM, NATIVE, or UNKNOWN |
BazelTestRunner, -Dbazel.test_suite=, test-setup.sh, or promoted native test leaf |
Workspace, output base, and embedded JDK¶
For BAZEL_SERVER, Daemonitor extracts --workspace_directory= (falling back to cwd), --output_base=, and --install_base=.
- Embedded JDK probing: Resolves
<install_base>/embedded_tools/jdksojcmd,jstat, andjinfocan probe the Bazel server even when no systemJAVA_HOMEis configured. - Server logs: Watches
command.logandserver/jvm.outunder the server's--output_base.
Subtree rollups and double-counting prevention¶
Because Bazel spawns short-lived sandboxed actions (sandbox-exec, linux-sandbox, process-wrapper) and compilers beneath BAZEL_SERVER:
- Pass 0 indexes the full OS process tree (up to depth 64) with
parent.start <= child.startPID-reuse validation. - Unclassified Bazel descendants are sampled cheaply (RSS and CPU only—no JVM probes) and rolled into
BAZEL_SERVER's inclusiveSubtreeRSSMemoryMB,SubtreeCPUPercent,ActiveWorkerCount, andActiveSandboxedActionCount. - Section summaries and resource aggregators (
AggregateResources) useSubtreeRSSMemoryMB/SubtreeCPUPercentonBAZEL_SERVERand exclude visible children owned by that server (OwnerPID+OwnerStartTimeMs) to prevent double-counting.
Build Event Protocol (BEP) and JSON profiles¶
- Passive BEP discovery: When a
bazel/bazeliskclient specifies--build_event_json_fileor--build_event_binary_file,daemonitor-coredparses the BEP stream into structuredBazelBuildDetails(memory,timing,actions,workers,worker_pools,tests,test_totals,diagnostics) stored inbazel_build_details. - JSON trace profiles:
cored/internal/bazelprofilecan also ingest Bazel's default gzipped JSON trace profiles without requiring BEP flags. - Incarnation-scoped build windows: Peak/average RSS and CPU are computed per Bazel server incarnation (
ResolveBazelServerIncarnation) without double-counting workers.