Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* `BrowserErrorLog`, OAP Server generated UUID to replace the original client side ID, because Browser scripts can't guarantee generated IDs are globally unique.
* MQE: fix multiple labeled metric query and ensure no results are returned if no label value combinations match.
* Fix `BrowserErrorLog` BanyanDB storage query order.
* `BanyanDB Client`: Property query support `Order By`.

#### UI
* Fix the missing icon in new native trace view.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;
import java.util.Set;
import lombok.Setter;
import org.apache.skywalking.banyandb.model.v1.BanyandbModel;
import org.apache.skywalking.banyandb.property.v1.BanyandbProperty;
import org.apache.skywalking.library.banyandb.v1.client.grpc.exception.BanyanDBException;

Expand All @@ -39,6 +40,8 @@ public class PropertyQuery extends AbstractQuery<BanyandbProperty.QueryRequest>
* Specific property IDs to query
*/
private List<String> ids;

private OrderBy orderBy;

/**
* Construct a property query with required fields
Expand Down Expand Up @@ -95,7 +98,32 @@ public BanyandbProperty.QueryRequest build() throws BanyanDBException {
if (!this.ids.isEmpty()) {
builder.addAllIds(this.ids);
}

if (this.orderBy != null) {
builder.setOrderBy(orderBy.build());
}
return builder.build();
}

public static class OrderBy {
private final String tagName;
private final Sort type;

/**
* Create an orderBy condition with given tag name and sort type
*/
public OrderBy(final String tagName, final Sort type) {
this.tagName = tagName;
this.type = type;
}

BanyandbProperty.QueryOrder build() {
final BanyandbProperty.QueryOrder.Builder builder = BanyandbProperty.QueryOrder.newBuilder();
if (tagName != null) {
builder.setTagName(tagName);
}
builder.setSort(
Sort.DESC.equals(type) ? BanyandbModel.Sort.SORT_DESC : BanyandbModel.Sort.SORT_ASC);
return builder.build();
}
}
}
Loading