Skip to content

[feat][trace] reserve trace cached ingest - #604

Open
taoyifan89 wants to merge 13 commits into
mainfrom
feat/reserve-trace-cached-ingest
Open

[feat][trace] reserve trace cached ingest#604
taoyifan89 wants to merge 13 commits into
mainfrom
feat/reserve-trace-cached-ingest

Conversation

@taoyifan89

Copy link
Copy Markdown
Collaborator

What type of PR is this?

Check the PR title

  • This PR title match the format: [<type>][<scope>] <description>. For example: [fix][backend] flaky fix
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Add documentation if the current PR requires user awareness at the usage level.
  • This PR is written in English. PRs not in English will not be reviewed.

(Optional) Translate the PR title into Chinese

(Optional) More detailed description for this PR(en: English/zh: Chinese)

en:
zh(optional):

(Optional) Which issue(s) this PR fixes

taoyifan89 and others added 8 commits July 29, 2026 14:45
…race navigation

同 thread 内以当前 trace 为锚点按方向返回相邻 trace(trace_id + start_time)。
服务端固定 ±7 天时间窗,trace_id != 锚点自排除,方向决定排序,Limit=1;
边界返回 ResourceNotFoundCode。复用空间维度鉴权 AuthActionTraceRead。

Change-Id: Ia175e7660373e69530bb692cf941bfc7e06c23b1
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change-Id: Id1fa0075a32263acb9b23a31c2a35c24fdb8bbc0
SearchTrace/SearchTraceTree now fetch the full span set via cursor
pagination (capped at 100k) instead of a single capped query, so the
frontend gets a complete trace tree without protocol changes. Drop the
obsolete search_trace_tree_max_span_limit config.

Change-Id: Ie45daa5a077a5f146dc50f819025cb565fb70188
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
GetTraceAll previously passed FetchAllMaxSpanLimit (100k) as the per-page
limit into GetTrace. For WithDetail=false, GetTrace unconditionally honors
req.Limit, turning cursor pagination into a single 100k ClickHouse query
(a likely gateway-timeout cause on large traces). Now GetTraceAll sets each
page's limit to the natural page size (1000 with detail / 10000 without),
which also keeps req.Limit>0 so GetTrace orders descending, consistent with
the repo-layer cursor filter (start_time < token).

Also fix a stale GetAdjacentTrace/boundary_not_found test: an empty result
is a normal "no adjacent trace" outcome that returns an empty response with
nil error, not a ResourceNotFound error.

Change-Id: I28cd4246fd6b29ef916fcfee522fafe1bf8e51ff
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…hen no adjacent trace

When no adjacent trace is found in the thread, return an empty
trace_id/start_time response (code=0) with an info log, instead of
raising ResourceNotFoundCode.

Change-Id: I1f3431ab9c11f8f654b31d6f7d89bbc3d14c5611
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…trace

Change-Id: I41f300d4b38c808cf96a5ddaf1e6ca2d1d0d49bc
… cache

Introduce TraceScene (default/cached) threaded through SearchTraceOApi and
internal GetTrace: application layer resolves scene with per-workspace switch
(trace_scene_cfg) and degrades cached->default on miss/error; scene flows via
service GetTraceReq/SearchTraceOApiReq into repo GetTraceParam and
GetTraceStorage(...scene) so commercial can route cached reads to Abase.

Change-Id: I25183cec461375f0303c1e5201f08196e0b7b4c0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ene 枚举

将存储路由 seam 的 scene 从裸 string 改为强类型枚举,消除调用点
的 string() 转换与拼写风险。

Change-Id: I71604eb759c938a0103e1f5419dc1771688f88cb
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.47059% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...bservability/domain/trace/service/trace_service.go 60.41% 10 Missing and 9 partials ⚠️
...end/modules/observability/infra/storage/storage.go 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (76.47%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #604      +/-   ##
==========================================
+ Coverage   77.91%   77.93%   +0.01%     
==========================================
  Files         689      689              
  Lines       83540    83557      +17     
==========================================
+ Hits        65092    65121      +29     
+ Misses      14577    14562      -15     
- Partials     3871     3874       +3     
Flag Coverage Δ
unittests 77.93% <76.47%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ckend/modules/observability/application/openapi.go 85.44% <100.00%> (+0.20%) ⬆️
backend/modules/observability/application/trace.go 78.64% <100.00%> (+0.01%) ⬆️
...es/observability/domain/component/config/config.go 39.28% <ø> (ø)
...ervability/domain/trace/entity/loop_span/filter.go 72.26% <ø> (ø)
...ackend/modules/observability/infra/config/trace.go 65.11% <100.00%> (+1.47%) ⬆️
backend/modules/observability/infra/repo/trace.go 86.25% <100.00%> (ø)
...end/modules/observability/infra/storage/storage.go 0.00% <0.00%> (ø)
...bservability/domain/trace/service/trace_service.go 89.77% <60.41%> (+0.78%) ⬆️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3350980...565735e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

taoyifan89 and others added 5 commits August 5, 2026 16:23
cached trace 查询在原按空间限流基础上增加独立限流配额,限流 QPS 值
兼任开关:>0 开放 cached 热缓存并按此限流,<=0/缺失降级走 default 限流。
删除 TraceSceneCfg 与两处 resolveTraceScene,开关判定收敛进限流逻辑。
SearchTraceOApi 走 AllowByKeyWithScene 返回生效 scene;GetTrace 信任上游直传。

Change-Id: Id6dc83520d6632c1fc14d58c52006a2ada4617e5
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ched-ingest

Change-Id: Id38ee16b88f38654db4322b84c7d2d0b0be4488c
…rough

GetTraceRequest 新增 optional need_original_tags 字段(field 14),
GetTrace 透传 req.GetNeedOriginalTags() 到 SpanListDO2DTO,使内部 caller
(如 ob_query cached 读链路)可请求原始分类型 tags,避免下游按字符串再推断类型。
默认 false,行为不变,向前兼容。

Change-Id: I014a34814b33ffc0bace6389f80d3bd5ec3f9fd0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
新增 runSpanProcessors 帮助函数,链式执行 span 查询 processors 时为每个
processor 记录处理耗时(%T + cost + span_num,scene 标识调用链),便于定位
慢 processor。11 条查询链路 + applyProcessors 统一走该帮助函数;写路径
IngestTraces 不受影响。

Change-Id: Ie26307073e0f5a146947038517e0efa10555577b
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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.

2 participants