Skip to content

Commit e43c128

Browse files
authored
BanyanDB: fix Zipkin query by annotationQuery (#13430)
1 parent e23aa31 commit e43c128

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

docs/en/changes/changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
* Bump up netty to 4.2.4.Final.
6464
* Bump up commons-lang to 3.18.0.
6565
* BanyanDB: support group `replicas` and `user/password` for basic authentication.
66-
* BanyanDB: fix Zipkin query missing tag `QUERY`.
66+
* BanyanDB: fix Zipkin query by `annotationQuery`
6767

6868
#### UI
6969

oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBZipkinQueryDAO.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,15 @@ public void apply(final StreamQuery query) {
230230
}
231231

232232
if (!CollectionUtils.isEmpty(request.annotationQuery())) {
233+
List<String> queryConditions = new ArrayList<>();
233234
for (Map.Entry<String, String> annotation : request.annotationQuery().entrySet()) {
234235
if (annotation.getValue().isEmpty()) {
235-
query.and(eq(ZipkinSpanRecord.QUERY, annotation.getKey()));
236+
queryConditions.add(annotation.getKey());
236237
} else {
237-
query.and(eq(ZipkinSpanRecord.QUERY, annotation.getKey() + "=" + annotation.getValue()));
238+
queryConditions.add(annotation.getKey() + "=" + annotation.getValue());
238239
}
239240
}
241+
query.and(having(ZipkinSpanRecord.QUERY, queryConditions));
240242
}
241243

242244
if (request.minDuration() != null) {

test/e2e-v2/cases/zipkin/zipkin-cases.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ cases:
1818
- query: curl http://${oap_host}:${oap_9412}/zipkin/api/v2/services
1919
expected: expected/service-name.yml
2020
# remote-service name
21-
- query: curl http://${oap_host}:${oap_9412}/zipkin/api/v2/remoteServices?serviceName=frontend
21+
- query: curl "http://${oap_host}:${oap_9412}/zipkin/api/v2/remoteServices?serviceName=frontend"
2222
expected: expected/remote-service-name.yml
2323
# span name
24-
- query: curl http://${oap_host}:${oap_9412}/zipkin/api/v2/spans?serviceName=frontend
24+
- query: curl "http://${oap_host}:${oap_9412}/zipkin/api/v2/spans?serviceName=frontend"
2525
expected: expected/span-name.yml
2626
# traces
27-
- query: curl http://${oap_host}:${oap_9412}/zipkin/api/v2/traces?serviceName=frontend&remoteServiceName=backend&spanName=get&annotationQuery=wr&limit=1
27+
- query: curl "http://${oap_host}:${oap_9412}/zipkin/api/v2/traces?serviceName=frontend&remoteServiceName=backend&spanName=get&annotationQuery=wr&limit=1"
2828
expected: expected/traces.yml
2929
# autocomplete
3030
- query: curl http://${oap_host}:${oap_9412}/zipkin/api/v2/autocompleteKeys
3131
expected: expected/autocomplete-keys.yml
32-
- query: curl http://${oap_host}:${oap_9412}/zipkin/api/v2/autocompleteValues?key=http.method
32+
- query: curl "http://${oap_host}:${oap_9412}/zipkin/api/v2/autocompleteValues?key=http.method"
3333
expected: expected/autocomplete-value.yml

0 commit comments

Comments
 (0)