Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,38 @@ jobs:
npm i
npm run test tests/remote-e2e/static-failover/

TestRemoteE2EDnsPeriodic:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node-version: [ 20, 22, 24 ]
env:
SW_NODE_VERSION: ${{ matrix.node-version }}
SW_OAP_IMAGE: ghcr.io/apache/skywalking/oap@sha256:f3fd1982c0344db2150780ea71bd51afc1f8fd7f482f73f01429a72151c857f6
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Set Up NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Remote E2E On Node@${{ matrix.node-version }} (dns-periodic real OAP)
run: |
npm i
npm run test tests/remote-e2e/dns-periodic/

TestRemoteE2EMTLS:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down
27 changes: 22 additions & 5 deletions docs/en/advanced/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,24 @@ export SW_AGENT_COLLECTOR_BACKEND_SERVICES=oap.example.com:11800
Check DNS, network access, firewall rules, and the OAP gRPC port.

One `host:port` uses the grpc-js `dns:` resolver (all A/AAAA records become endpoints and are
re-resolved periodically). A comma-separated list uses a static resolver with `pick_first`: each
name is a literal endpoint only — no DNS expansion or re-resolution per name, so discovery is weaker
than a single DNS name (for example a headless Kubernetes service).
re-resolved on demand by grpc-js when the channel needs fresh addresses — not on a fixed agent timer). A comma-separated list uses a static resolver with `pick_first`: by
default each name is a literal endpoint only — no DNS expansion or re-resolution per name, so
discovery is weaker than a single DNS name (for example a headless Kubernetes service).

To expand and periodically refresh multiple DNS names, set
`SW_AGENT_IS_RESOLVE_DNS_PERIODICALLY=true` (or `isResolveDnsPeriodically: true` in `agent.start()`).
`SW_AGENT_COLLECTOR_IS_RESOLVE_DNS_PERIODICALLY` is accepted as a Java-aligned alias.
The agent resolves each hostname to all A/AAAA records (each lookup times out after 5s),
dials the resulting IP list via
`sw-static` (including when expansion yields a single IP), and re-resolves every 30 seconds
(override with `SW_AGENT_DNS_RE_RESOLVE_INTERVAL_SECONDS`, or the Java-aligned
`SW_AGENT_COLLECTOR_GRPC_CHANNEL_CHECK_INTERVAL`). Failed names keep their last-known endpoints
so a partial DNS outage does not shrink the dial set; the gRPC channel is rebuilt when the
merged address set changes, and open is retried on later ticks if no channel was installed yet.
Timer ticks that arrive while a resolve is still running are skipped (no overlapping resolve).
Under TLS, when endpoints are IP literals, the agent uses the first configured
hostname in the list as SNI / authority unless `SW_AGENT_SSL_TARGET_NAME_OVERRIDE` is set. All backends must
still present certificates that share the needed SANs.

An option passed to `agent.start()` replaces the environment value. This includes an empty string:

Expand All @@ -53,8 +68,10 @@ With Apache OAP, point the agent at the mTLS-enabled `receiver-sharing-server` g
(commonly port `11801`, or the port selected by `SW_RECEIVER_GRPC_PORT`). Do not assume that the
regular OAP agent listener on port `11800` requests client certificates.

Under TLS with multiple hostnames, certificate verification follows the channel authority (the first
list entry in the configured target). Endpoint pick order may be shuffled by grpc-js, but the target
Under TLS with multiple backends, certificate verification follows the channel authority.
With periodic multi-name DNS expand, that is the first **hostname** in the configured list
(not an IP literal earlier in the list). Without DNS expand, authority follows the first list
entry in the configured target. Endpoint pick order may be shuffled by grpc-js, but the target
string — and therefore authority / SNI — stays in config order. Every backend must present a
certificate that shares the needed SANs, or failover handshakes fail. Prefer one DNS name with
multiple A/AAAA records for TLS high availability.
Expand Down
4 changes: 2 additions & 2 deletions docs/en/contribution/build-and-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Run the TypeScript lint check:
npm run lint
```

Run unit tests without Docker plugin suites:
Run unit tests without Docker plugin suites or remote e2e:

```bash
npx jest --testPathIgnorePatterns '/node_modules/' '/tests/plugins/' --runInBand
npx jest --testPathIgnorePatterns '/node_modules/' '/tests/plugins/' '/tests/remote-e2e/' --runInBand
```

Run all tests, including Docker plugin suites:
Expand Down
4 changes: 3 additions & 1 deletion docs/en/setup/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Node.js process. `SW_DISABLE` is checked when `start()` is called.
| --- | --- | --- | --- |
| `SW_AGENT_NAME` | `serviceName` | `your-nodejs-service` | Service name shown in SkyWalking. |
| `SW_AGENT_INSTANCE` | `serviceInstance` | Host name | Service instance name shown in SkyWalking. |
| `SW_AGENT_COLLECTOR_BACKEND_SERVICES` | `collectorAddress` | `127.0.0.1:11800` | OAP gRPC address(es). One `host:port` uses grpc-js `dns:` (all A/AAAA become endpoints; periodically re-resolved). A comma-separated list uses a static resolver with `pick_first` (literal endpoints only; no per-name DNS expansion or re-resolution). Endpoint pick order is shuffled by grpc-js (`shuffleAddressList`); the target string keeps config order so TLS authority / SNI stay on the first list entry. Under TLS, all backends must present certificates that share the needed SANs. Prefer one DNS name with multiple A/AAAA records for TLS high availability. |
| `SW_AGENT_COLLECTOR_BACKEND_SERVICES` | `collectorAddress` | `127.0.0.1:11800` | OAP gRPC address(es). One `host:port` uses grpc-js `dns:` (all A/AAAA become endpoints; re-resolved on demand by grpc-js, not on a fixed agent timer). A comma-separated list uses a static resolver with `pick_first`. By default each list entry is a literal endpoint (no per-name DNS expansion or re-resolution). Set `SW_AGENT_IS_RESOLVE_DNS_PERIODICALLY=true` to expand every hostname to its A/AAAA records and re-resolve every 30s (override with `SW_AGENT_DNS_RE_RESOLVE_INTERVAL_SECONDS`), rebuilding the channel when the address set changes or retrying open when no channel is installed yet. Failed names keep last-known endpoints in the dial set so partial DNS outages do not shrink a working channel or block recovery when another name's IPs change. Endpoint pick order is shuffled by grpc-js (`shuffleAddressList`); the target string keeps config order so TLS authority / SNI stay on the first list entry (after DNS expand, the first configured hostname in the list is used as authority when dialing IPs). Under TLS, all backends must present certificates that share the needed SANs. Prefer one DNS name with multiple A/AAAA records for TLS high availability when periodic multi-name DNS is not enabled. |
| `SW_AGENT_IS_RESOLVE_DNS_PERIODICALLY` | `isResolveDnsPeriodically` | `false` | When `true` and `collectorAddress` lists multiple backends that include hostnames, expand each name to all A/AAAA addresses (per-name lookup timeout 5s) and periodically re-resolve (30s). Rebuilds when the resolved set changes; also retries open on later ticks if the channel was never opened. Single-address targets ignore this flag (grpc-js `dns:` already re-resolves). All-IP multi-address lists do not start a timer. `SW_AGENT_COLLECTOR_IS_RESOLVE_DNS_PERIODICALLY` is accepted as a Java-aligned alias. |
| `SW_AGENT_DNS_RE_RESOLVE_INTERVAL_SECONDS` | — | `30` | Interval for multi-backend DNS re-resolve when `SW_AGENT_IS_RESOLVE_DNS_PERIODICALLY=true`. Positive decimal integer seconds for the whole value (rejects 1.5, 1e3, 10junk); invalid values and values that overflow the Node timer limit fall back to 30. `SW_AGENT_COLLECTOR_GRPC_CHANNEL_CHECK_INTERVAL` is accepted as a Java-aligned alias (same default 30s). Overlapping ticks while a resolve is still running are skipped. |
| `SW_AGENT_SECURE` | `secure` | `false` | Use TLS for the OAP gRPC connection. |
| `SW_AGENT_SSL_TRUSTED_CA_PATH` | `sslTrustedCaPath` | Not set | Optional trusted CA certificate file for TLS server verification. Relative paths are resolved from the process working directory. |
| `SW_AGENT_SSL_KEY_PATH` | `sslKeyPath` | Not set | Client private key file for mTLS. Must be configured together with `sslCertChainPath` and `secure=true`. |
Expand Down
Loading
Loading