[BanyanDB] Let trace queries exclude the raw span from results
メンテナーはふだん 1 日以内に返信
@hanahmily がすでに取り組んでいます。
2026年12月1日 から。
評価
この issue はまだ評価されていません。
説明
Search before asking
- I had searched in the issues and found no similar feature requirement.
Description
Users extract the fields they need from a span into a binary tag (see #14282) and read them through tag_projection. Once that's done, the raw span bytes are not needed, but there is no way to leave them out. Every layer of a trace query always carries them:
- API:
QueryRequest(api/proto/banyandb/trace/v1/query.proto) can only project tags;Span.spanis always filled. - Storage:
block.mustReadFromalways callsmustReadSpansFrom, which reads, decompresses and decodes every span body. - Result assembly:
assembleVectorizedTraceResultsclones every span intoTraceResult.Spans. - Distributed:
trace_frame.goserializes the spans from data node to liaison, andmergeTraceResultSpanscarries them along. - Response:
banyand/query/processor.goandbanyand/liaison/grpc/trace.gocopy them intoSpan.span.
Span IDs and span bodies are written to the same data block (mustWriteSpansTo), so reading the IDs also reads the bodies. Span IDs are still required, because the cross-node merge removes duplicates by span ID.
Proposal
-
API: add an opt-out field to
trace.v1.QueryRequest:// exclude_span omits the raw span bytes from the response; span_id and the // projected tags are still returned. Default false keeps the current behavior. bool exclude_span = 11;Opt-out keeps existing clients unchanged. A reserved name in
tag_projection(e.g._span) is rejected: it could collide with a real tag name and would silently change results for old clients. -
Query model and planner: add
ExcludeSpantomodel.TraceQueryOptionsand set it intrace_plan_local.go. The distributed plan already forwardsoriginalQuery. -
Storage read path:
block.mustReadFrom(..., excludeSpan bool)decodes only the span-ID section (DecodeWithTail) and leavesb.spansascountnil entries, so per-row arrays stay aligned.assembleVectorizedTraceResultsskips cloning spans and charges the memory budget for span-ID and projected-tag bytes instead ofuncompressedSpanSizeBytes. -
Count rows by
SpanIDs: replacelen(result.Spans)withlen(result.SpanIDs)where it means the number of rows:trace_plan_tag_filter.go, the empty-bucket check inquery_vectorized.go, and the span counts inprocessor.go. Intrace_frame.go, a nil span encodes as zero length, so the wire format doesn't change. -
Liaison response: when
exclude_spanis set, always clearSpan.spanin the response builders. This also covers old data nodes that ignore the field and still return spans.
Compatibility
- Old clients: default
false, so behavior is unchanged. - Mixed versions: old data nodes ignore the field and return spans, and the liaison drops them, so the client sees the same result. Only the savings are lost on those nodes. No on-disk format change.
Follow-up (not in scope)
To also skip disk reads and decompression of span bodies, record the length of the span-ID prefix in blockMetadata so a span-excluded read only fetches that range. blockMetadata has no version field, and its marker check rejects values above 1, so this needs a part format version and a downgrade plan. Measure the gain from this issue's changes with the trace benchmarks first.
Tests
- Block read with
excludeSpan: span IDs and tag values are correct, spans are nil with the right count. Parity with the full read (vectorized_parity_test.go). - Memory budget: a query whose spans exceed the budget succeeds when span IDs and projected tags fit.
- Distributed: duplicate removal by span ID with nil spans; frame round trip.
- Liaison: spans from a data node that ignores the flag are removed.
- Integration (
test/cases/trace): project only a binary tag withexclude_span: true; expect an emptyspanwithspan_idand tag values filled.
Use case
Clients that only need fields already extracted into tags save span decode CPU, memory, network transfer and response size, especially for traces with large spans.
Related issues
#14282
Are you willing to submit a pull request to implement this on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project's Code of Conduct
- 主要言語
- Java
- スター
- 25k
- フォーク
- 6.6k
- 平均マージ
- 10時間 45分
- マージ済み PR(30日)
- 49
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/skywalking のほかの issue
-
[Bug] [BanyanDB] timestamp.ParseDuration silently drops everything after "d"対応中かも @soujasK が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
apache/skywalking#14287 ·
メンテナーはふだん 1 日以内に返信
-
[BanyanDB] Data race and nil-pointer panic: measure write during standalone shutdown after segment close対応中かも @hanahmily が今日担当しました。 オープンbug
apache/skywalking#14285 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
apache/skywalking#14283 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BanyanDB] Store trace binary tags only in core storage, not in secondary index (sidx)対応中かも @hanahmily が今日担当しました。 オープンenhancement
apache/skywalking#14282 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] BanyanDB stream query on a hot entity scans all its rows despite a small limit対応中かも @hanahmily が 8 日前に担当しました。 オープンbug
apache/skywalking#14261 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
apache/skywalking の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
testng-team/testng#3672 ·
メンテナーはふだん 1 日以内に返信
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
eclipse-edc/IdentityHub#1296 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
cloudfoundry/uaa#4194 ·
メンテナーはふだん 1 日以内に返信
-
area: ui priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
tetsuji16/microProject#1721 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信