fix: support v1 trace query protocol for non-BanyanDB storages - #43
Merged
Conversation
wu-sheng
force-pushed
the
fix/trace-query-v1-fallback
branch
from
July 6, 2026 09:02
f442777 to
57219ea
Compare
The query_traces tool only spoke the trace-v2 GraphQL API (queryTraces), which is BanyanDB-only. On Elasticsearch/JDBC storages and older OAP releases it failed with "Field 'queryTraces' is undefined" or "Only BanyanDB storage support Trace V2 query now". Detect backend support via the hasQueryTracesV2Support field and fall back to the legacy queryBasicTraces + queryTrace (v1) protocol, assembling the result into the same TraceList shape so downstream processing is identical. The queryTrace `duration` argument is omitted deliberately: it is BanyanDB-only and absent on OAP < 10.3.0, so including it would break the fallback on exactly the older backends it targets. Also bump docker/setup-buildx-action and docker/login-action in publish-docker.yaml to currently-approved ASF SHAs (v4.2.0 / v4.4.0); the old v3-era pins were rotated out of the ASF approved-actions list. Document the ASF actions gotcha, the comment convention, and the AI co-author trailer in CLAUDE.md. Fixes apache/skywalking#13939 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
wu-sheng
force-pushed
the
fix/trace-query-v1-fallback
branch
from
July 6, 2026 09:03
57219ea to
8b8f0bf
Compare
wankai123
approved these changes
Jul 6, 2026
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.
Problem
Fixes apache/skywalking#13939.
query_tracesonly used the trace-v2 GraphQL API (queryTraces), which is BanyanDB-only. On Elasticsearch/JDBC storages and older OAP releases it fails:Validation error (FieldUndefined@[queryTraces]): Field 'queryTraces' in type 'Query' is undefinedOnly BanyanDB storage support Trace V2 query nowThe tool had no way to tell which protocol the backend supports.
Fix
Detect backend capability via the
hasQueryTracesV2Supportfield, then route:queryTracespath, unchanged.queryBasicTraces+ per-tracequeryTrace, assembled into the sameTraceListshape so the summary / errors_only / full views work identically.hasQueryTracesV2SupportandqueryTraceswere introduced together in OAP, so a backend has both or neither — any detection error safely falls back to v1.Note on the
queryTracedurationargumentOmitted deliberately.
durationis BanyanDB-only and does not exist on OAP < 10.3.0, so including it would break the fallback on exactly the older, non-BanyanDB backends this path targets (Unknown argument 'duration').Known limitation (documented in code + tool description)
On non-BanyanDB storages
queryBasicTracespaginates over trace segments, sopage_sizebounds segments, not whole traces; segments of the same distributed trace are de-duplicated here by trace ID, so a broad query may return fewer thanpage_sizetraces. Narrowing by service/endpoint keeps the ratio ~1:1.Testing
trace_test.go, mock GraphQL server): v1↔v2 routing, segment→trace dedup, and a regression guard asserting the v1 query never carriesduration.true→ v2 path returns real data end-to-end through the built binary.test/e2e-v2/cases/storage/es, OAP master + ES 8.18.8 + provider/consumer apps):queryTraceson ES →Only BanyanDB storage support Trace V2 query now.hasQueryTracesV2Supporton ES →false.swmcpend-to-end → v1 path → real traces:summaryview returned 10 traces across both services;fullview assembled a complete 10-span cross-service trace with correctCROSS_PROCESSrefs, confirming dedup.make build,make lint, unit tests, and license header check all pass.Also in this PR
build(ci)— bumpdocker/setup-buildx-actionanddocker/login-actioninpublish-docker.yamlto currently-approved ASF SHAs (v4.2.0 / v4.4.0). The old v3-era pins were rotated out of the ASF approved-actions list; since the workflow only runs on push-to-main/release, the next docker publish would otherwise be blocked with "action is not allowed".docs— record inCLAUDE.mdthe ASF allowed-actions gotcha, the "comment only when the code is not clear" convention, and the AI co-author trailer.🤖 Generated with Claude Code