Skip to content

burstObservatory on top of the traffic re-probes (#290) - #352

Open
aimalygin wants to merge 4 commits into
mainfrom
claude/burst-observatory-on-reprobes
Open

aimalygin wants to merge 4 commits into
mainfrom
claude/burst-observatory-on-reprobes

Conversation

@aimalygin

@aimalygin aimalygin commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

The merge commit of the unchanged head of #290 on current main (3a70b2d), so that the pull request closes as merged, and one commit on top that pins how it lives beside #308.

Commit What
#290 57aba3c, merged as 47a5792 burstObservatory is read and run as in Xray-core v26.11.9, with its window statistics for leastLoad, leastPing, random and roundRobin
on top c8f87de Two tests and a documented difference: failures of real traffic bring no re-probes beside a burst observatory

The review of #290 asked its author for a rebase onto #308 and for three things with it. #308 is in main now, and this branch does them here instead.

The merge

#290's base predates #308, and the two overlap in how a probe's result is recorded. This is not a mechanical merge, so it is described file by file.

The classic observatory is unchanged by #290's reworked window: only the burst loop starts a new network epoch, and without a burst policy every sample stays valid, so its window is the last 16 scheduled probes as before. #308's test of that window passes on the merged code.

On top (c8f87de)

observatory: pin what failures of real traffic do beside a burst observatory

  • traffic_failures_bring_no_reprobe_under_the_burst_observatory: under a burst policy a reported failure leaves no slot pending, since only the classic observatory's loop watches the slots, and a re-probe's result recorded all the same changes neither the window nor the health read from it.
  • the_classic_observatory_governs_when_both_are_configured: a core with both observatories starts the classic probes and sends no burst ping.
  • docs/xray-core-differences.md lists "Failures of real traffic" among the deliberate differences of burstObservatory, and the CHANGELOG.md entry names it.

Review notes

  • The three points of the review hold on this branch: Re-probe observed outbounds when real traffic fails to dial them #308's path without a sample is kept; beside burstObservatory alone nothing follows traffic failures, so its window stays the last sampling scheduled pings, as in healthping_result.go; with both observatories observatory governs and its re-probes apply.
  • Read on the merged tree: the recording path, the observers' start-up in Core::start, the burst loop with its connectivity gate, and the window's record and metrics. Not read line by line: the parser (parser/burst_observatory.rs), the changes to startup_probe.rs and feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков #290's own tests.
  • A burst observatory with a connectivity URL requests it over the device's own network, outside every outbound, after a failed ping. That is Xray-core's behaviour and happens only when the URL is configured.
  • With Xray-core's defaults a subject is pinged ten times in ten minutes. On a phone that is radio time; it is what the configuration asks for.

Verification

Update: main merged in (fc52100)

#351 and #353 went into main after this branch was cut, and #353 conflicted with it in two files, each side adding entries at the same place:

  • crates/xray-config/src/surface.rs: the root object's keys of both, burstObservatory beside the inert root apps and fakeDns, with main's note.
  • tests/fixtures/config-tooling/cases.json: both appended cases to the list; main's ten stay and this branch's three follow them.

docs/config-contract.json merged without a conflict and equals what config_contract generates from the merged sources.

On fc52100 locally, all with --locked: cargo fmt --all -- --check; clippy for the whole workspace with the CI flags; cargo test -p xray-config (770 passed, 0 failed, 1 ignored); cargo test -p xray-transport --lib (812 passed); cargo test -p xray-core-rs --lib (837 passed, 0 failed, 4 ignored) with health_observatory_tests (9), startup_probe_tests (22), core_lifecycle_tests (27) and address_port_phone_tests (1); the public-fixtures gate; rustdoc with -D warnings. All pass.

🤖 Generated with Claude Code

dec0iiyy and others added 3 commits November 13, 2026 15:52
…кна для балансировщиков

Корневой ключ burstObservatory раньше отклонялся как неизвестное поле.
Теперь он читается как в Xray-core v26.11.9: subjectSelector и обязательный
pingConfig (destination, connectivity, interval, sampling, timeout,
httpMethod) с умолчаниями и нижними границами NewHealthPing.

Планировщик: один пинг каждого исходящего при старте, затем sampling пингов
в случайные моменты каждого периода interval * sampling. Пингует тот же
пробник, что и observatory, с методом из httpMethod; проверка connectivity
идёт напрямую, мимо исходящих.

Статистика для leastLoad, leastPing, random и roundRobin: последние sampling
пингов не старше двух периодов, исходящий жив, пока в окне есть успех,
задержка равна среднему, отклонение одного успеха равно половине среднего.
Неудачный пинг не засчитывается, если не ответил и connectivity.

Если заданы оба наблюдателя, выбором управляет observatory, как в Xray-core;
burstObservatory проверяется, даёт предупреждение и не запускается.

Намеренные отличия, описаны в docs/xray-core-differences.md:
- верхние границы interval 24h, sampling 100, timeout 60s с предупреждением;
- не больше четырёх пингов одновременно;
- пока connectivity не отвечает, уходит один пинг за паузу от 5 с до
  interval, а не каждый запланированный;
- после смены сети (rebind_quic) каждый исходящий пингуется заново через
  1-3 с, и первый новый замер заменяет окно прежней сети;
- httpMethod, не являющийся HTTP-токеном, и непригодные URL отклоняются.

CoreConfig получает поле burst_observatory, NetworkChanges получает observe:
подписку, которую notify не считает соединением.
feat(observatory): burstObservatory как в Xray-core, со статистикой окна для балансировщиков

Merged on top of #308, whose re-probes on failures of real traffic the
pull request's base did not have.

crates/xray-core-rs/src/outbound.rs: both recorded a probe's result. #308
keeps a re-probe out of the leastLoad window (HealthSample::StateOnly);
this pull request made one record_health_probe that always adds a sample
and, under a burst observatory, reads the health from the window. They
are one function now: a sample enters the window, a re-probe sets the
state, the last delay and the failure count without one, and under a
burst observatory, beside which no re-probe runs, a probe that is no
sample leaves the window's health alone. select() keeps main's Option.

crates/xray-core-rs/src/health.rs: the imports of both; main's
kind-aware record_result; the module's Instant stays tokio's, as #308's
clocks need, and the burst code names std's in full.

crates/xray-transport/src/network_change.rs: generation(), added on main
for the DNS connection pools, reads the connections signal of the two
this pull request split the changes into.

crates/xray-core-rs/src/dns.rs: a test's CoreConfig gains the new field.

CHANGELOG.md: the entry goes to the end of the Unreleased list.
…rvatory

#308 has the classic observatory probe an outbound again when a flow
fails to open through it. The burst observatory merged after it is a
loop of its own and follows none of that, which is what its window of
the last sampling pings needs. Nothing said so or held it.

- traffic_failures_bring_no_reprobe_under_the_burst_observatory: under a
  burst policy a reported failure leaves no slot pending, since no
  observatory watches one, and a re-probe's result recorded all the same
  changes neither the window nor the health read from it.
- the_classic_observatory_governs_when_both_are_configured: a core with
  both starts the classic probes and sends no burst ping.
- docs/xray-core-differences.md lists the difference under
  burstObservatory, and the CHANGELOG entry names it.
Main gained #351 and #353 since this branch was cut. Two files conflict
with #353, both because each side adds entries at the same place:

crates/xray-config/src/surface.rs: the root object's keys of both,
burstObservatory beside the inert root apps and fakeDns, with main's
note, which is this branch's plus the sentences on those.

tests/fixtures/config-tooling/cases.json: both appended cases to the
list. Main's ten stay, and this branch's three follow them.
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.

2 participants