Skip to content

feat(nodejs): gRPC TLS/DNS failover, 12 runtime meters, Java agent.core alignment#140

Closed
songzhendong wants to merge 1 commit into
apache:masterfrom
songzhendong:feature/periodic-dns-re-resolve-grpc-backend-v2
Closed

feat(nodejs): gRPC TLS/DNS failover, 12 runtime meters, Java agent.core alignment#140
songzhendong wants to merge 1 commit into
apache:masterfrom
songzhendong:feature/periodic-dns-re-resolve-grpc-backend-v2

Conversation

@songzhendong

Copy link
Copy Markdown
Contributor

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 v2GRPCChannelManager 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/envSW_AGENT_NODEJS_COMMIT=7c7eba5

Companion OAP PR: songzhendong/skywalking #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.

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):

  • Build (Node 20 / 22 / 24)
  • License
  • Lint + TestLib
  • TestUnitRemote (config / core / remote / runtime) × 20/22/24
  • TestRemoteE2E (static-failover, dns-re-resolve) × 20/22/24
  • TestPlugins matrix (express meterSize 12, axios, http, ioredis, mongodb, mysql, …)

OAP e2e-v2 (songzhendong/skywalking #6, pin 7c7eba5):

  • Agent NodeJS Backend / Frontend / Frontend ES / Frontend ES Sharding
  • 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

Rebased onto apache/skywalking-nodejs master @ 36df516 (apache#139).
Fork CI: PR #7.

Signed-off-by: songzhendong <songzhendong@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant