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

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

commit 7a1c34fcab8026eabae6b482f48e483a6661e98b
Author: Gao Hongtao <[email protected]>
AuthorDate: Mon Jul 15 14:36:07 2024 +0800

    Document how to use query tracing
    
    Signed-off-by: Gao Hongtao <[email protected]>
---
 README.md | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 80b7865..ba893e4 100644
--- a/README.md
+++ b/README.md
@@ -135,7 +135,7 @@ client.query(query);
 After response is returned, `elements` can be fetched,
 
 ```java
-StreamQueryResponse resp = client.queryStreams(query);
+StreamQueryResponse resp = client.query(query);
 List<RowEntity> entities = resp.getElements();
 ```
 
@@ -145,6 +145,23 @@ The `StreamQueryResponse`, `RowEntity`, `TagFamily` and 
`Tag` (i.e. `TagAndValue
 the order of the tag families and containing tags, i.e. indexes of these 
objects in the List, follow the order specified 
 in the projection condition we've used in the request.
 
+If you want to trace the query, you can use `query.enableTrace()` to get the 
trace spans.
+
+```java
+// enable trace
+query.enableTrace();
+// send the query request
+client.query(query);
+```
+
+After response is returned, `trace` can be extracted,
+
+```java
+// send the query request
+StreamQueryResponse resp = client.queryStreams(query);
+Trace t = resp.getTrace();
+```
+
 ### Measure
 
 For `Measure`, it is similar to the `Stream`,
@@ -193,6 +210,22 @@ query.offset(1);
 query.orderBy("service_id", Sort.DESC);
 ```
 
+If you want to trace the query, you can use `query.enableTrace()` to get the 
trace spans.
+
+```java
+// enable trace
+query.enableTrace();
+// send the query request
+client.query(query);
+```
+
+After response is returned, `trace` can be extracted,
+
+```java
+// send the query request
+MeasureQueryResponse resp = client.query(query);
+Trace trace = resp.getTrace();
+```
 ### Criteria
 
 Both `StreamQuery` and `MeausreQuery` support the `criteria` flag to filter 
data.

Reply via email to