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

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


The following commit(s) were added to refs/heads/main by this push:
     new 78ab486  Document how to use query tracing (#65)
78ab486 is described below

commit 78ab4864f2d3fdb28cab9082876d52da38f53dc5
Author: Gao Hongtao <[email protected]>
AuthorDate: Mon Jul 15 14:51:31 2024 +0800

    Document how to use query tracing (#65)
---
 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