This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch feat/trace-response
in repository 
https://gitbox.apache.org/repos/asf/skywalking-banyandb-java-client.git

commit 83ae5c05007bb3910d31d9f2f4a6f57d9b8de6ac
Author: Gao Hongtao <hanahm...@gmail.com>
AuthorDate: Tue Sep 9 19:45:59 2025 +0800

    Update proto to use new trace response
    
    Signed-off-by: Gao Hongtao <hanahm...@gmail.com>
---
 .../banyandb/v1/client/BanyanDBClient.java         | 43 ----------------------
 .../banyandb/v1/client/TraceQueryResponse.java     | 16 ++++----
 src/main/proto/banyandb/v1/banyandb-trace.proto    | 14 +++----
 .../banyandb/v1/client/BanyanDBClientTestCI.java   |  2 +-
 .../skywalking/banyandb/v1/client/ITTraceTest.java | 37 ++++++++++++-------
 5 files changed, 39 insertions(+), 73 deletions(-)

diff --git 
a/src/main/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClient.java 
b/src/main/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClient.java
index 777aaf1..bcae829 100644
--- a/src/main/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClient.java
+++ b/src/main/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClient.java
@@ -428,49 +428,6 @@ public class BanyanDBClient implements Closeable {
         return new TraceWrite(this.metadataCache.findTraceMetadata(group, 
name));
     }
 
-    /**
-     * Build a trace bulk write processor.
-     *
-     * @param maxBulkSize   the max size of each flush. The actual size is 
determined by the length of byte array.
-     * @param flushInterval if given maxBulkSize is not reached in this 
period, the flush would be trigger
-     *                      automatically. Unit is second.
-     * @param concurrency   the number of concurrency would run for the flush 
max.
-     * @param timeout       network timeout threshold in seconds.
-     * @return trace bulk write processor
-     */
-    public TraceBulkWriteProcessor buildTraceWriteProcessor(int maxBulkSize, 
int flushInterval, int concurrency, int timeout) {
-        checkState(this.traceServiceStub != null, "trace service is null");
-
-        return new TraceBulkWriteProcessor(this, maxBulkSize, flushInterval, 
concurrency, timeout, WRITE_HISTOGRAM, options);
-    }
-
-    /**
-     * Build a TraceWrite request.
-     *
-     * @param group     the group of the trace
-     * @param name      the name of the trace
-     * @param timestamp the timestamp of the trace
-     * @return the request to be built
-     */
-    public TraceWrite createTraceWrite(String group, String name, long 
timestamp) throws BanyanDBException {
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(group));
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(name));
-        return new TraceWrite(this.metadataCache.findTraceMetadata(group, 
name), timestamp);
-    }
-
-    /**
-     * Build a TraceWrite request without initial timestamp.
-     *
-     * @param group the group of the trace
-     * @param name  the name of the trace
-     * @return the request to be built
-     */
-    public TraceWrite createTraceWrite(String group, String name) throws 
BanyanDBException {
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(group));
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(name));
-        return new TraceWrite(this.metadataCache.findTraceMetadata(group, 
name));
-    }
-
     /**
      * Query streams according to given conditions
      *
diff --git 
a/src/main/java/org/apache/skywalking/banyandb/v1/client/TraceQueryResponse.java
 
b/src/main/java/org/apache/skywalking/banyandb/v1/client/TraceQueryResponse.java
index a1dc368..4fdd714 100644
--- 
a/src/main/java/org/apache/skywalking/banyandb/v1/client/TraceQueryResponse.java
+++ 
b/src/main/java/org/apache/skywalking/banyandb/v1/client/TraceQueryResponse.java
@@ -33,12 +33,12 @@ public class TraceQueryResponse {
     }
 
     /**
-     * Get the list of spans returned by the query.
+     * Get the list of traces returned by the query.
      *
-     * @return list of spans
+     * @return list of traces, each containing spans grouped by trace ID
      */
-    public List<BanyandbTrace.Span> getSpans() {
-        return response.getSpansList();
+    public List<BanyandbTrace.Trace> getTraces() {
+        return response.getTracesList();
     }
 
     /**
@@ -54,18 +54,18 @@ public class TraceQueryResponse {
     }
 
     /**
-     * Get the total number of spans returned.
+     * Get the total number of traces returned.
      *
-     * @return span count
+     * @return trace count
      */
     public int size() {
-        return response.getSpansCount();
+        return response.getTracesCount();
     }
 
     /**
      * Check if the response is empty.
      *
-     * @return true if no spans were returned
+     * @return true if no traces were returned
      */
     public boolean isEmpty() {
         return size() == 0;
diff --git a/src/main/proto/banyandb/v1/banyandb-trace.proto 
b/src/main/proto/banyandb/v1/banyandb-trace.proto
index 5fa8401..d58c969 100644
--- a/src/main/proto/banyandb/v1/banyandb-trace.proto
+++ b/src/main/proto/banyandb/v1/banyandb-trace.proto
@@ -21,7 +21,6 @@ package banyandb.trace.v1;
 
 import "banyandb/v1/banyandb-common.proto";
 import "banyandb/v1/banyandb-model.proto";
-import "google/api/annotations.proto";
 
 option go_package = 
"github.com/apache/skywalking-banyandb/api/proto/banyandb/trace/v1";
 option java_package = "org.apache.skywalking.banyandb.trace.v1";
@@ -51,8 +50,12 @@ message Span {
   bytes span = 2;
 }
 
-message QueryResponse {
+message Trace {
   repeated Span spans = 1;
+}
+
+message QueryResponse {
+  repeated Trace traces = 1;
   common.v1.Trace trace_query_result = 2;
 }
 
@@ -71,12 +74,7 @@ message QueryRequest {
 
 // RPC service
 service TraceService {
-  rpc Query(QueryRequest) returns (QueryResponse) {
-    option (google.api.http) = {
-      post: "/v1/trace/data"
-      body: "*"
-    };
-  }
+  rpc Query(QueryRequest) returns (QueryResponse);
 
   rpc Write(stream WriteRequest) returns (stream WriteResponse);
 }
\ No newline at end of file
diff --git 
a/src/test/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClientTestCI.java
 
b/src/test/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClientTestCI.java
index eec6b3b..9e3b64b 100644
--- 
a/src/test/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClientTestCI.java
+++ 
b/src/test/java/org/apache/skywalking/banyandb/v1/client/BanyanDBClientTestCI.java
@@ -31,7 +31,7 @@ import java.io.IOException;
 public class BanyanDBClientTestCI {
     private static final String REGISTRY = "ghcr.io";
     private static final String IMAGE_NAME = "apache/skywalking-banyandb";
-    private static final String TAG = 
"65504b5d925a15cc0ab1004f6e7cbceb65b20f83";
+    private static final String TAG = 
"a287c38c758b11ea2d83014875af2e72acfaa017";
 
     private static final String IMAGE = REGISTRY + "/" + IMAGE_NAME + ":" + 
TAG;
 
diff --git 
a/src/test/java/org/apache/skywalking/banyandb/v1/client/ITTraceTest.java 
b/src/test/java/org/apache/skywalking/banyandb/v1/client/ITTraceTest.java
index 76eb168..15a16df 100644
--- a/src/test/java/org/apache/skywalking/banyandb/v1/client/ITTraceTest.java
+++ b/src/test/java/org/apache/skywalking/banyandb/v1/client/ITTraceTest.java
@@ -158,14 +158,19 @@ public class ITTraceTest extends BanyanDBClientTestCI {
             TraceQueryResponse response = client.query(query);
             Assert.assertNotNull("Query response should not be null", 
response);
             Assert.assertFalse("Should have at least one result", 
response.isEmpty());
-            Assert.assertEquals("Should have exactly one span", 1, 
response.size());
+            Assert.assertEquals("Should have exactly one trace", 1, 
response.size());
             
-            // Verify we can access span data
-            Assert.assertNotNull("Spans list should not be null", 
response.getSpans());
-            Assert.assertEquals("Should have one span in list", 1, 
response.getSpans().size());
+            // Verify we can access trace data
+            Assert.assertNotNull("Traces list should not be null", 
response.getTraces());
+            Assert.assertEquals("Should have one trace in list", 1, 
response.getTraces().size());
             
-            // Get the first span and verify its contents
-            org.apache.skywalking.banyandb.trace.v1.BanyandbTrace.Span span = 
response.getSpans().get(0);
+            // Get the first trace and verify its contents
+            org.apache.skywalking.banyandb.trace.v1.BanyandbTrace.Trace trace 
= response.getTraces().get(0);
+            Assert.assertNotNull("Trace should not be null", trace);
+            Assert.assertEquals("Trace should have exactly one span", 1, 
trace.getSpansCount());
+            
+            // Get the span from the trace and verify its contents
+            org.apache.skywalking.banyandb.trace.v1.BanyandbTrace.Span span = 
trace.getSpans(0);
             Assert.assertNotNull("Span should not be null", span);
             
             // Verify span data (binary content) - this is the main content 
returned
@@ -228,15 +233,21 @@ public class ITTraceTest extends BanyanDBClientTestCI {
             TraceQueryResponse response = client.query(query);
             Assert.assertNotNull("Query response should not be null", 
response);
             Assert.assertFalse("Should have at least one result", 
response.isEmpty());
-            Assert.assertTrue("Should have exactly 2 spans", response.size() 
== 2);
+            Assert.assertTrue("Should have exactly 2 traces", response.size() 
== 2);
+            
+            // Verify we can access trace data
+            Assert.assertNotNull("Traces list should not be null", 
response.getTraces());
+            Assert.assertTrue("Should have exactly 2 traces in list", 
response.getTraces().size() == 2);
+            
+            // Get spans from each trace and verify that span content matches 
expected data
+            org.apache.skywalking.banyandb.trace.v1.BanyandbTrace.Trace 
firstTrace = response.getTraces().get(0);
+            org.apache.skywalking.banyandb.trace.v1.BanyandbTrace.Trace 
secondTrace = response.getTraces().get(1);
             
-            // Verify we can access span data
-            Assert.assertNotNull("Spans list should not be null", 
response.getSpans());
-            Assert.assertTrue("Should have exactly 2 spans in list", 
response.getSpans().size() == 2);
+            Assert.assertEquals("First trace should have exactly one span", 1, 
firstTrace.getSpansCount());
+            Assert.assertEquals("Second trace should have exactly one span", 
1, secondTrace.getSpansCount());
             
-            // Verify that span content matches expected data
-            String firstSpanContent = new 
String(response.getSpans().get(0).getSpan().toByteArray());
-            String secondSpanContent = new 
String(response.getSpans().get(1).getSpan().toByteArray());
+            String firstSpanContent = new 
String(firstTrace.getSpans(0).getSpan().toByteArray());
+            String secondSpanContent = new 
String(secondTrace.getSpans(0).getSpan().toByteArray());
             
             // Since we're ordering by start_time DESC, span-data-2 should 
come before span-data-1
             // (baseTime+60 > baseTime)

Reply via email to