mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5972] [Bug]: Xray Metrics not shown metrics for Outbounds with flag in their names #4138
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4138
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nebulosa2007 on GitHub (Jul 15, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5972
Describe the bug
I see in Xray Metrics only
warpoutbound but inObservatoryI have several outboundsHow to reproduce the problem
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
3x-ui version
3.5.0
Xray-core version
26.7.11
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Frontend (UI / panel pages)
Browser (only if it is a UI bug)
Chrome
Is the panel behind a reverse proxy or CDN?
Yes — Nginx
Before submitting
@github-actions[bot] commented on GitHub (Jul 15, 2026):
Title: Xray Metrics' Observatory tab silently drops outbound tags containing any character outside
[a-zA-Z0-9._-]Severity: Medium
Category: Correctness
Why this matters: The tag list shown in the panel's "Xray Metrics" → Observatory tab comes from
XrayMetricsService.ObservatorySnapshot()(internal/web/service/xray_metrics.go:80-89), which only returns tags present in the in-memoryobsByTagmap. That map is populated inapplyObservatory(internal/web/service/xray_metrics.go:195-215), and any tag that failsvalidObsTag.MatchString(tag)is skipped before it's ever added (line 202-204) — so it never reaches theGET /panel/api/server/xrayObservatoryresponse the frontend dropdown is built from (frontend/src/pages/index/XrayMetricsModal.tsx,fetchObservatory). The same regex separately guardsHasObservatoryTagandAggregateObservatory(lines 91-99, 101-106), so a direct history request for such a tag is also rejected by the controller as "invalid tag" (internal/web/controller/server.go:171-182).The regex is:
(
internal/web/service/xray_metrics.go:51) — ASCII letters/digits/./_/-only. Any tag containing a space, emoji (including flag emoji used for country identification), or non-Latin text fails this and is silently dropped, even though:/debug/vars) reports them correctly, consistent with your report that Observatory itself lists several outbounds.OutboundTagSchemaandBalancerFormSchema.tag(frontend/src/schemas/xray.ts:112-130) only require a non-empty tag that doesn't start with the reserved_bl_prefix.system_metrics.gob(internal/web/service/metric_history.go:300), and only ever uses the tag as an in-memory map key / JSON field, never as a filename or path — so there's no filesystem-safety reason for an ASCII-only allowlist either.This also explains why
warpis the one tag still showing up: it is the literal, hardcoded tag that 3x-ui's built-in Cloudflare WARP integration matches on (tag == "warp",internal/web/service/xray_setting.go:84), which is plain ASCII and passes the filter, unlike your other, presumably flag-prefixed, balancer members.Recommendation: Relax
validObsTagto accept the same tag values the rest of the panel already allows (effectively any non-empty string), instead of an ASCII allowlist. The tag is only ever used as a map key / JSON value (never a filename), and the frontend alreadyencodeURIComponents it before using it in the history URL (XrayMetricsModal.tsx:212), so a strict charset restriction doesn't appear to protect anything currently in use. A minimal check (non-empty, perhaps excluding control characters) inapplyObservatory,HasObservatoryTag, andAggregateObservatoryshould be enough.Confidence: high — traced end-to-end from the regex definition through both call sites and the controller wiring, and cross-checked that outbound tags are unrestricted everywhere else in the panel (frontend schema, Xray-core config, and the metrics persistence layer).
@MHSanaei
This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 23, 2026):
Fixed in #6083. Validates observatory outbound tags as bounded, control-free UTF-8 instead of ASCII-only, so flag-emoji / non-ASCII tags appear in metrics and health notifications.
mixedlocal inbound leaves iOS clients (Happ) connected with zero traffic #4327mixedlocal inbound leaves iOS clients (Happ) connected with zero traffic #4327mixedlocal inbound leaves iOS clients (Happ) connected with zero traffic #4327