lujiajing1126 commented on code in PR #10448: URL: https://github.com/apache/skywalking/pull/10448#discussion_r1118731890
########## oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/MetadataRegistry.java: ########## @@ -173,24 +172,31 @@ public Measure registerMeasureModel(Model model, BanyanDBStorageConfig config, C schemaBuilder.field(field.getName()); } // parse TopN - schemaBuilder.topNSpec(parseTopNSpec(model, schemaMetadata.name())); + schemaBuilder.topNSpec(parseTopNSpec(model, schemaMetadata.name(), tagsAndFields)); registry.put(schemaMetadata.name(), schemaBuilder.build()); return builder.build(); } - private TopNSpec parseTopNSpec(final Model model, final String measureName) { - final String valueCName = ValueColumnMetadata.INSTANCE.getValueCName(model.getName()); - if (StringUtil.isEmpty(valueCName)) { + private TopNSpec parseTopNSpec(final Model model, final String measureName, MeasureMetadata tagsAndFields) { + final Optional<ValueColumnMetadata.ValueColumn> valueColumnOpt = ValueColumnMetadata.INSTANCE.readValueColumnDefinition(model.getName()); + if (valueColumnOpt.isEmpty()) { return null; } - // TODO: how to configure parameters? + + List<String> groupByTagNames = new ArrayList<>(); + groupByTagNames.add(Metrics.ENTITY_ID); + for (final TagMetadata tagSpec : tagsAndFields.tags) { + if (tagSpec.getTagSpec().getTagName().equals(InstanceTraffic.SERVICE_ID)) { + groupByTagNames.add(InstanceTraffic.SERVICE_ID); Review Comment: If we add an array to `TopNAggregation`, do we need to annotate all Metrics that should have TopN support? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@skywalking.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org