Conversation
matrix72c
force-pushed
the
feat/external-otel-collector
branch
from
August 24, 2026 14:09
d6f6738 to
7681fde
Compare
matrix72c
force-pushed
the
feat/external-otel-collector
branch
from
September 7, 2026 03:51
4c80db2 to
fa952bf
Compare
Collaborator
|
最简单的修复是否是 driver 提供的endpoint为其真实IP,而非 127.0.0.1,这个问题能否一起帮忙修复下?支持external collector 本身没问题。 |
Ray child processes may run on other hosts; a 127.0.0.1 endpoint would point them at their own loopback. Reuse the same convention as weight_update/transport.py: ray.util.get_node_ip_address() with a gethostbyname fallback.
Collaborator
|
@claude review |
Contributor
|
Claude: Summary本 PR 新增 Main Flowchart after this PRflowchart TD
A[configure_trace_runtime] --> B[_build_trace_runtime_handle]
B --> C{external_otlp_endpoint 已配置?}
C -- 是 --> D["endpoint = external<br/>trace_jsonl_path = external 或 None<br/>port = None<br/>start_local_collector = False"]
C -- 否 --> E["创建 run_dir/traces/traces.jsonl<br/>endpoint = http://_local_advertised_host:port<br/>start_local_collector = True"]
D --> F[handle.start]
E --> F
F --> G{"mode==driver 且 start_local_collector?"}
G -- 是 --> H["三处防御式 RuntimeError 校验<br/>_OTelCollector.start"]
G -- 否 --> I[_configure_tracer_provider]
H --> I
I --> J{viewer 已启用?}
J -- 是 --> K["校验 trace_jsonl_path<br/>启动 viewer 子进程"]
J -- 否 --> L[env_vars 注入 Ray 子进程]
K --> M["viewer: payload_cache 延迟加载<br/>首个请求才 stat + load"]
M --> N{JSONL 文件已存在?}
N -- 否 --> O["FileNotFoundError 未捕获<br/>do_GET 抛栈,连接被重置"]
N -- 是 --> P[返回 payload]
K --> L
style D fill:#cfe8ff
style E fill:#cfe8ff
style G fill:#cfe8ff
style H fill:#ffe0b2
style M fill:#cfe8ff
style O fill:#ffcdd2
说明:蓝色为本 PR 改动节点,橙色为设计摩擦点,红色为 Warning 级缺陷点。 核心原理实现与单测核心行为均有真实代码路径覆盖,mock 只限于项目外部依赖(
缺口在于「JSONL 尚未生成时对 viewer 发起真实请求」这一新窗口没有任何用例(见下文单测建议)。 抽象与信息隐藏评估
公开 Interface 的线性业务流程评估
单测建议
其他 Issues
VerdictREQUEST_CHANGES |
- viewer: return empty payload instead of an unhandled exception when the collector-owned JSONL does not exist yet, and cover it with a real HTTP request before the file is created - runtime: warn when the advertised driver host resolves to a loopback address, replace unreachable defensive RuntimeError guards with asserts, document when TraceRuntime.trace_jsonl_path is None
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow XTuner processes to export spans to an externally managed, network-reachable OTLP collector while preserving the existing driver-local collector and viewer defaults.
Motivation
The default trace path introduced in #1946 uses a collector on the driver's loopback address. In a multi-pod deployment, a remote Ray actor resolves
127.0.0.1to its own pod, so it cannot reach the driver's collector and its spans are missing from the JSONL and Jaeger traces.This PR allows the producers to use a routable collector Service instead:
Configuration
external_otlp_endpointis propagated to Ray child processes so every process exports to the same reachable collector.external_trace_jsonl_pathonly tells the driver-side viewer where to read the collector-owned JSONL file; it does not configure or start the collector and is not propagated to Ray child processes.service.nameand XTunerrun.id, so the file may contain spans from multiple runs.xtuner_viewer_enabled=False; no JSONL path is required.Compatibility
When
external_otlp_endpointis unset, local collector startup, per-runtraces.jsonloutput, viewer startup, and shutdown behavior remain unchanged. External collectors are never started or stopped by XTuner.Tests
ruff check.compileall.git diff --check.