songzhendong opened a new pull request, #140:
URL: https://github.com/apache/skywalking-nodejs/pull/140

   ### Summary
   
   This PR extends the Node.js agent remote layer to align with the **Java 
`agent.core` gRPC architecture**, and expands runtime metrics from 6 to **12** 
`instance_nodejs_*` meters.
   
   1. **gRPC v2** — `GRPCChannelManager` multi-backend failover, TLS/mTLS, 
per-hostname SNI, DNS expand (A/AAAA), optional periodic DNS re-resolve, IPv6 
`formatHostPort`, `CommandService` ingestion.
   2. **Runtime metrics** — six additional meters (`array_buffers`, `uptime`, 
`peak_malloced_memory`, `detached_contexts`, `old_space_used`, 
`new_space_used`); canonical env `SW_AGENT_RUNTIME_METRICS_*` with legacy 
aliases retained.
   
   **Not in this PR:** OAP MAL rules / dashboards (separate PR required), 
release version bump, Profile/Log/Event clients, full Command executor 
registration.
   
   ### Motivation
   
   - **Cross-language parity:** Java agent already uses `GRPCChannelManager`, 
TLS, DNS expansion, and periodic re-resolve; Node previously lacked equivalent 
failover and TLS/SNI behavior (notably Kubernetes Headless Service → Pod IP 
with cert hostname mismatch).
   - **Maintainability:** v1 refactor introduced `agent.core` layout; v2 
completes remote connectivity features on that foundation.
   
   ### OAP companion (required for 12-meter dashboards)
   
   Meter **reporting** is in this PR. **OAP consumption** (MAL analyzer + 
dashboard docs + e2e-v2 TLS/DNS/auth cases) is a **separate PR** to 
`apache/skywalking`:
   
   | Item | Location |
   |------|----------|
   | 12 MAL rules | `meter-analyzer-config/nodejs-runtime.yaml` |
   | Dashboard doc | `docs/en/setup/backend/dashboards-nodejs-runtime.md` |
   | Node.js e2e (ssl / mtls / ssl-dns / auth) | `test/e2e-v2/cases/nodejs/*` |
   | Agent pin | `test/e2e-v2/script/env` → `SW_AGENT_NODEJS_COMMIT=7c7eba5` |
   
   Companion OAP PR: [songzhendong/skywalking 
#6](https://github.com/songzhendong/skywalking/pull/6).
   
   ### Intentional differences from Java (please review)
   
   | Area | Java | This PR | Tag |
   |------|------|---------|-----|
   | Auth failure (`UNAUTHENTICATED` / `PERMISSION_DENIED`) | Treated as 
network error → reconnect | Log warn, **no reconnect** | Stricter ops behavior |
   | mTLS paths set but PEM missing | Warn, continue one-way TLS | **throw** at 
channel build | Stricter |
   | Meter burst on reconnect | No per-tick snapshot cap | 
`SW_AGENT_RUNTIME_METRICS_MAX_SNAPSHOTS_PER_REPORT` default **1** | Tunable 
guard |
   | Exported `config` to apps | `Config.Agent.AUTHENTICATION` readable | 
`publicAgentConfig` omits `authorization` | Node-only hardening |
   
   Operational constraints (DNS lookup blocking, runtime sampling on main 
thread, etc.): 
[`docs/nodejs-grpc-constraints.md`](docs/nodejs-grpc-constraints.md).
   
   ### Key env vars (new / renamed)
   
   | Variable | Purpose |
   |----------|---------|
   | `SW_AGENT_IS_RESOLVE_DNS_PERIODICALLY` | Periodic DNS re-resolve (Java 
`collector.is_resolve_dns_periodically`) |
   | `SW_AGENT_GRPC_CHANNEL_CHECK_INTERVAL` | Channel health check interval 
(seconds) |
   | `SW_AGENT_FORCE_RECONNECTION_PERIOD` | Force reconnect period multiplier |
   | `SW_AGENT_FORCE_TLS` / `SW_AGENT_SSL_*` | TLS/mTLS material paths |
   | `SW_AGENT_COLLECTOR_GRPC_UPSTREAM_TIMEOUT` | gRPC call deadline (seconds) |
   | `SW_AGENT_RUNTIME_METRICS_*` | Runtime meter pipeline (replaces 
`SW_AGENT_NODEJS_RUNTIME_METRICS_*` as canonical) |
   
   Legacy `SW_AGENT_NODEJS_RUNTIME_METRICS_*`, `SW_AGENT_NVM_*` aliases still 
accepted with deprecation warnings.
   
   ### Test plan
   
   **Agent CI** ([Actions run @ 
`7c7eba5`](https://github.com/songzhendong/skywalking-nodejs/actions/runs/28783670639)):
   
   - [x] Build (Node 20 / 22 / 24)
   - [x] License
   - [x] Lint + TestLib
   - [x] **TestUnitRemote** (config / core / remote / runtime) × 20/22/24
   - [x] **TestRemoteE2E** (`static-failover`, `dns-re-resolve`) × 20/22/24
   - [x] **TestPlugins** matrix (express meterSize 12, axios, http, ioredis, 
mongodb, mysql, …)
   
   **OAP e2e-v2** ([songzhendong/skywalking 
#6](https://github.com/songzhendong/skywalking/pull/6), pin `7c7eba5`):
   
   - [x] Agent NodeJS Backend / Frontend / Frontend ES / Frontend ES Sharding
   - [x] Agent NodeJS SSL / SSL DNS / mTLS / Auth
   
   ### Files of note
   
   | Path | Role |
   |------|------|
   | `src/agent/core/remote/*` | Channel manager, TLS, DNS resolver, clients |
   | `src/agent/core/commands/*` | OAP command queue + dispatch framework |
   | `src/agent/core/meter/*` | 12 runtime meters |
   | `tests/remote-e2e/*` | Docker-compose failover E2E (CI) |
   | `tests/remote/*` | Unit tests for remote layer |
   | `docs/nodejs-grpc-constraints.md` | Node/grpc-js operational notes |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to