This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/skywalking-graalvm-distro.git
commit ddf65d51e64286ae5a5a9e2c0150082efce9bbc7 Author: Wu Sheng <[email protected]> AuthorDate: Wed Feb 18 00:18:03 2026 +0800 Initial version: SkyWalking GraalVM Distro Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .gitmodules | 3 ++ CLAUDE.md | 25 +++++++++++ PLAN.md | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 14 ++++++ skywalking | 1 + 5 files changed, 183 insertions(+) diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..10610c8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "skywalking"] + path = skywalking + url = https://github.com/apache/skywalking.git diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..a72762d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,25 @@ +# SkyWalking GraalVM Distro - Development Guide + +## Project Structure +- `skywalking/` — Git submodule of `apache/skywalking.git`. **Do not modify directly.** All SkyWalking source changes go through upstream PRs. +- `PLAN.md` — Current build plan (draft/temporary, subject to change). +- Root-level Maven + Makefile — Orchestrates building on top of the submodule. + +## Key Principles +1. **Minimize upstream changes.** SkyWalking is a submodule. Changes to it require separate upstream PRs and syncing back. +2. **Build-time class export.** All runtime code generation (OAL via Javassist, MAL/LAL via Groovy) runs at build time. Export `.class` files into native-image classpath. +3. **Fixed module wiring.** Module/provider selection is hardcoded in this distro — no SPI discovery. See PLAN.md for the full module table. +4. **JDK 25.** Already compiles and runs. + +## Technical Notes +- **OAL engine**: Generates metrics classes via Javassist at startup. For native image, run OAL engine at build time, export `.class` files. +- **MAL/LAL**: Use Groovy `GroovyShell` for runtime script evaluation. For native image, use Groovy static compilation (`@CompileStatic`), export `.class` files. +- **OAL has never relied on Groovy.** OAL uses ANTLR4 + FreeMarker + Javassist. +- **Classpath scanning**: Guava `ClassPath.from()` used in multiple places. Run at build-time pre-compilation as verification gate, export static class index. +- **Config loading**: `YamlConfigLoaderUtils.copyProperties()` uses `Field.setAccessible()` + `field.set()`. Register known `ModuleConfig` classes for GraalVM reflection. + +## Selected Modules +- **Storage**: BanyanDB +- **Cluster**: Kubernetes +- **Configuration**: Kubernetes +- **Receivers/Query/Analyzers/Alarm/Telemetry/Other**: Full feature set (see PLAN.md for details) \ No newline at end of file diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..db745f7 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,140 @@ +# SkyWalking GraalVM Distro - Build Plan + +## Goal +Build and package Apache SkyWalking OAP server as a GraalVM native image on JDK 25. + +## Architecture Constraints +- **Submodule**: `skywalking/` is a git submodule of `apache/skywalking.git`. All SkyWalking source changes go through upstream PRs. **Minimize upstream changes.** +- **This repo**: Maven + Makefile to orchestrate building on top of the submodule. Pre-compilation, GraalVM config, native-image wiring, and the fixed module manager live here. +- **JDK 25**: Already compiles and runs. Not an issue. + +## Module Selection (Fixed at Build Time) + +| Category | Module | Provider | +|----------|--------|----------| +| **Core** | CoreModule | default | +| **Storage** | StorageModule | BanyanDB | +| **Cluster** | ClusterModule | Kubernetes | +| **Configuration** | ConfigurationModule | Kubernetes | +| **Receivers** | SharingServerModule, TraceModule, JVMModule, MeterReceiverModule, LogModule, RegisterModule, ProfileModule, BrowserModule, EventModule, OtelMetricReceiverModule, MeshReceiverModule, EnvoyMetricReceiverModule, ZipkinReceiverModule, ZabbixReceiverModule, TelegrafReceiverModule, AWSFirehoseReceiverModule, CiliumFetcherModule, EBPFReceiverModule, AsyncProfilerModule, PprofModule, CLRModule, ConfigurationDiscoveryModule, KafkaFetcherModule | default providers | +| **Analyzers** | AnalyzerModule, LogAnalyzerModule, EventAnalyzerModule | default providers | +| **Query** | QueryModule (GraphQL), PromQLModule, LogQLModule, ZipkinQueryModule, StatusQueryModule | default providers | +| **Alarm** | AlarmModule | default | +| **Telemetry** | TelemetryModule | Prometheus | +| **Other** | ExporterModule, HealthCheckerModule, AIPipelineModule | default providers | + +**Full feature set.** Work around issues as they arise. + +--- + +## Core Strategy + +1. **Build-Time Class Export**: All runtime code generation (OAL via Javassist, MAL/LAL via Groovy) runs at build time. Export `.class` files and package into native-image classpath. Classpath scanning also runs here as a verification gate. + +2. **Fixed Module Wiring**: Module/provider selection is hardcoded in this distro (no SPI discovery). Simplified config file for selected providers only. + +3. **Separation**: SkyWalking upstream changes tracked separately, go through upstream PRs. + +--- + +## Challenge 1: OAL Runtime Class Generation (Javassist) + +### What Happens +OAL V2 generates metrics/builder/dispatcher classes at startup via Javassist (`ClassPool.makeClass()` → `CtClass.toClass()`). Already has `writeGeneratedFile()` for debug export. + +### Approach (this repo) +All `.oal` scripts are known. Run OAL engine at build time, export `.class` files, load them directly in native-image mode. + +### Upstream Changes Needed +- Potentially expose build-time class export as a stable API (currently debug-only) + +--- + +## Challenge 2: MAL and LAL (Groovy) + +### What Happens +MAL uses `GroovyShell` + `Binding` for meter rules. LAL uses `GroovyShell` + `DelegatingScript` + `Closure` + AST customizers. + +### Approach (this repo) +Groovy static compilation (`@CompileStatic`). Pre-compile all MAL/LAL rule files at build time, export `.class` files. + +### Risks +- `@CompileStatic` may not cover all dynamic features (track and work around) +- May need DSL adjustments (upstream PRs) + +--- + +## Challenge 3: Classpath Scanning (Guava ClassPath) + +### What Happens +`ClassPath.from()` used in `SourceReceiverImpl.scan()`, `AnnotationScan`, `MeterSystem`, `DefaultMetricsFunctionRegistry`, `FilterMatchers`, `MetricsHolder`. + +### Approach (this repo) +Run classpath scanning during build-time pre-compilation. Verify all metrics/log-processing classes are discovered. Export scan results as static class index. Native-image mode loads from index. + +--- + +## Challenge 4: Module System & Configuration + +### Current Behavior +`ModuleManager` uses `ServiceLoader` (SPI). `application.yml` selects providers. Config loaded via reflection (`Field.setAccessible` + `field.set` in `YamlConfigLoaderUtils.copyProperties`). + +### Approach (this repo) +1. **New module manager**: Directly constructs chosen `ModuleDefine`/`ModuleProvider` — no SPI +2. **Simplified config file**: Only knobs for selected providers +3. **Config loading**: Register known `ModuleConfig` classes for GraalVM reflection. Existing `copyProperties` works in native image with field registration. + +--- + +## Challenge 5: Additional GraalVM Risks + +| Risk | Mitigation | +|------|------------| +| **Reflection** (annotations, OAL enricher) | Captured during pre-compilation; `reflect-config.json` | +| **gRPC 1.70.0 / Netty 4.2.9** | GraalVM reachability metadata repo, Netty substitutions | +| **Resource loading** (`ResourceUtils`, config files) | `resource-config.json` via tracing agent | +| **Log4j2** | GraalVM metadata, disable JNDI | +| **Kafka client** (for Kafka fetcher) | Known GraalVM support, may need config | +| **ElasticSearch client** (not used, BanyanDB selected) | N/A for now | +| **Kubernetes client 6.7.1** (for cluster + config) | Has GraalVM support, may need config | + +--- + +## Proposed Phases + +### Phase 1: Build System Setup +- [ ] Set up Maven + Makefile in this repo +- [ ] Build skywalking submodule as a dependency +- [ ] Set up GraalVM JDK 25 in CI +- [ ] Create a JVM-mode starter with fixed module wiring (validate approach before native-image) +- [ ] Simplified config file for selected modules + +### Phase 2: Build-Time Pre-Compilation & Verification +- [ ] Makefile/Maven step: run OAL engine → export `.class` files +- [ ] Makefile/Maven step: static-compile MAL Groovy scripts → export `.class` files +- [ ] Makefile/Maven step: static-compile LAL Groovy scripts → export `.class` files +- [ ] Makefile/Maven step: run classpath scanning → export class index +- [ ] Verify all metrics/log-processing classes are correctly discovered +- [ ] Package everything into native-image classpath + +### Phase 3: Native Image Build +- [ ] `native-image-maven-plugin` configuration +- [ ] Run tracing agent to capture reflection/resource/JNI metadata +- [ ] Configure gRPC/Netty/Protobuf for native image +- [ ] GraalVM Feature class for SkyWalking-specific registrations +- [ ] Get OAP server booting as native image with BanyanDB + +### Phase 4: Harden & Test +- [ ] Verify all receiver plugins work +- [ ] Verify all query APIs work +- [ ] Verify cluster mode (K8s) +- [ ] Verify alarm module +- [ ] Performance benchmarking vs JVM +- [ ] CI: automated native-image build + smoke tests + +--- + +## Upstream Changes Tracker +- [ ] OAL engine: stable build-time class export API +- [ ] MAL/LAL: DSL adjustments for Groovy static compilation (if needed) +- [ ] Other findings during implementation \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a55b89b --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# SkyWalking GraalVM Distro (Experimental) +<img src="http://skywalking.apache.org/assets/logo.svg" alt="Sky Walking logo" height="90px" align="right" /> + +GraalVM compiles your Java applications ahead of time into standalone binaries. These binaries are smaller, start up to 100x faster, +provide peak performance with no warmup, and use less memory and CPU than applications running on a Java Virtual Machine (JVM). + +SkyWalking GraalVM Distro is a re-distribution version of the official Apache SkyWalking OAP server. + + +## ⚠️ Release Policy ⚠️ +This repository is only on the experimental stage, no release will be made and driven by the PMC by the current status, until we have a way out. + +# License +Apache 2.0 diff --git a/skywalking b/skywalking new file mode 160000 index 0000000..b537891 --- /dev/null +++ b/skywalking @@ -0,0 +1 @@ +Subproject commit b5378919288e4e7992a0a794fa0126ff29a42702
