Skip to content

Commit 78ab486

Browse files
authored
Document how to use query tracing (#65)
1 parent 546180d commit 78ab486

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ client.query(query);
135135
After response is returned, `elements` can be fetched,
136136

137137
```java
138-
StreamQueryResponse resp = client.queryStreams(query);
138+
StreamQueryResponse resp = client.query(query);
139139
List<RowEntity> entities = resp.getElements();
140140
```
141141

@@ -145,6 +145,23 @@ The `StreamQueryResponse`, `RowEntity`, `TagFamily` and `Tag` (i.e. `TagAndValue
145145
the order of the tag families and containing tags, i.e. indexes of these objects in the List, follow the order specified
146146
in the projection condition we've used in the request.
147147

148+
If you want to trace the query, you can use `query.enableTrace()` to get the trace spans.
149+
150+
```java
151+
// enable trace
152+
query.enableTrace();
153+
// send the query request
154+
client.query(query);
155+
```
156+
157+
After response is returned, `trace` can be extracted,
158+
159+
```java
160+
// send the query request
161+
StreamQueryResponse resp = client.queryStreams(query);
162+
Trace t = resp.getTrace();
163+
```
164+
148165
### Measure
149166

150167
For `Measure`, it is similar to the `Stream`,
@@ -193,6 +210,22 @@ query.offset(1);
193210
query.orderBy("service_id", Sort.DESC);
194211
```
195212

213+
If you want to trace the query, you can use `query.enableTrace()` to get the trace spans.
214+
215+
```java
216+
// enable trace
217+
query.enableTrace();
218+
// send the query request
219+
client.query(query);
220+
```
221+
222+
After response is returned, `trace` can be extracted,
223+
224+
```java
225+
// send the query request
226+
MeasureQueryResponse resp = client.query(query);
227+
Trace trace = resp.getTrace();
228+
```
196229
### Criteria
197230

198231
Both `StreamQuery` and `MeausreQuery` support the `criteria` flag to filter data.

0 commit comments

Comments
 (0)