Skip to content

Commit 2caa01d

Browse files
authored
Add log for Endpoint direct topN query. (#13371)
1 parent b1d69fd commit 2caa01d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/en/setup/backend/storages/banyandb.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ global:
6464
asyncProfilerTaskQueryMaxSize: ${SW_STORAGE_BANYANDB_ASYNC_PROFILER_TASK_QUERY_MAX_SIZE:200}
6565
# If the BanyanDB server is configured with TLS, configure the TLS cert file path and enable TLS connection.
6666
sslTrustCAPath: ${SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH:""}
67-
67+
# Cleanup TopN rules in BanyanDB server that are not configured in the bydb-topn.yml config.
68+
cleanupUnusedTopNRules: ${SW_STORAGE_BANYANDB_CLEANUP_UNUSED_TOPN_RULES:true}
69+
6870
groups:
6971
# The group settings of record.
7072
# - "ShardNum": Number of shards in the group. Shards are the basic units of data storage in BanyanDB. Data is distributed across shards based on the hash value of the series ID.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.skywalking.oap.server.storage.plugin.banyandb;
2020

2121
import com.google.common.collect.ImmutableSet;
22+
import lombok.extern.slf4j.Slf4j;
2223
import org.apache.skywalking.banyandb.database.v1.BanyandbDatabase;
2324
import org.apache.skywalking.banyandb.model.v1.BanyandbModel;
2425
import org.apache.skywalking.banyandb.v1.client.AbstractQuery;
@@ -29,6 +30,7 @@
2930
import org.apache.skywalking.banyandb.v1.client.TopNQueryResponse;
3031
import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
3132
import org.apache.skywalking.oap.server.core.query.enumeration.Order;
33+
import org.apache.skywalking.oap.server.core.query.enumeration.Scope;
3234
import org.apache.skywalking.oap.server.core.query.input.AttrCondition;
3335
import org.apache.skywalking.oap.server.core.query.input.Duration;
3436
import org.apache.skywalking.oap.server.core.query.input.TopNCondition;
@@ -45,6 +47,7 @@
4547
import java.util.List;
4648
import java.util.Set;
4749

50+
@Slf4j
4851
public class BanyanDBAggregationQueryDAO extends AbstractBanyanDBDAO implements IAggregationQueryDAO {
4952
private static final Set<String> TAGS = ImmutableSet.of(Metrics.ENTITY_ID);
5053

@@ -139,6 +142,11 @@ List<SelectedRecord> serverSideTopN(boolean isColdStage, TopNCondition condition
139142

140143
List<SelectedRecord> directMetricsTopN(boolean isColdStage, TopNCondition condition, MetadataRegistry.Schema schema, String valueColumnName, MetadataRegistry.ColumnSpec valueColumnSpec,
141144
TimestampRange timestampRange, List<KeyValue> additionalConditions) throws IOException {
145+
if (log.isDebugEnabled()
146+
&& condition.getScope().equals(Scope.Endpoint)) {
147+
log.debug("Endpoint direct TopN query, TopNCondition: {}, AdditionalConditions: {}, TimestampRange: {}",
148+
condition, additionalConditions, timestampRange);
149+
}
142150
MeasureQueryResponse resp = queryDebuggable(isColdStage, schema, TAGS, Collections.singleton(valueColumnName),
143151
timestampRange, new QueryBuilder<MeasureQuery>() {
144152
@Override

0 commit comments

Comments
 (0)