Skip to content

Commit 443157b

Browse files
authored
BanyanDB: fix the BanyanDBMetricsDAO.multiGet not work properly in IndexMode. (#13457)
1 parent e8aef61 commit 443157b

File tree

31 files changed

+119
-226
lines changed

31 files changed

+119
-226
lines changed

docs/en/changes/changes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@
8888
| **Total** | **158** | - | - |
8989

9090
* BanyanDB: make `BanyanDBMetricsDAO` output `scan all blocks` info log only when the model is not `indexModel`.
91+
* BanyanDB: fix the `BanyanDBMetricsDAO.multiGet` not work properly in `IndexMode`.
92+
* BanyanDB: remove `@StoreIDAsTag`, and automatically create a virtual String tag `id` for the SeriesID in `IndexMode`.
93+
* Remove method `appendMutant` from StorageID.
9194

9295
#### UI
9396

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/cache/TopNCacheReadCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class TopNCacheReadCommand extends TopN {
4949

5050
@Override
5151
public StorageID id() {
52-
return new StorageID().appendMutant(null, id);
52+
return new StorageID().append(id);
5353
}
5454

5555
@Override

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/cache/TopNCacheWriteCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class TopNCacheWriteCommand extends TopN {
4949

5050
@Override
5151
public StorageID id() {
52-
return new StorageID().appendMutant(null, id);
52+
return new StorageID().append(id);
5353
}
5454

5555
@Override

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/database/TopNDatabaseStatement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class TopNDatabaseStatement extends TopN {
4949

5050
@Override
5151
public StorageID id() {
52-
return new StorageID().appendMutant(null, id);
52+
return new StorageID().append(id);
5353
}
5454

5555
@Override

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTraffic.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,13 @@ public class EndpointTraffic extends Metrics {
5757
@Setter
5858
@Getter
5959
@Column(name = SERVICE_ID)
60-
@BanyanDB.SeriesID(index = 0)
6160
private String serviceId;
6261
@Setter
6362
@Getter
6463
@Column(name = NAME)
6564
@ElasticSearch.Column(legacyName = "name")
6665
@ElasticSearch.MatchQuery
6766
@BanyanDB.MatchQuery(analyzer = BanyanDB.MatchQuery.AnalyzerType.URL)
68-
@BanyanDB.SeriesID(index = 1)
6967
private String name = Const.EMPTY_STRING;
7068
@Setter
7169
@Getter
@@ -77,11 +75,7 @@ protected StorageID id0() {
7775
// Downgrade the time bucket to day level only.
7876
// supportDownSampling == false for this entity.
7977
return new StorageID()
80-
.appendMutant(
81-
new String[] {
82-
SERVICE_ID,
83-
NAME
84-
},
78+
.append(
8579
IDManager.EndpointID.buildId(
8680
this.getServiceId(), this.getName())
8781
);

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/instance/InstanceTraffic.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,12 @@ public class InstanceTraffic extends Metrics {
6161
@Setter
6262
@Getter
6363
@Column(name = SERVICE_ID)
64-
@BanyanDB.SeriesID(index = 0)
6564
private String serviceId;
6665

6766
@Setter
6867
@Getter
6968
@Column(name = NAME, storageOnly = true)
7069
@ElasticSearch.Column(legacyName = "name")
71-
@BanyanDB.SeriesID(index = 1)
7270
private String name;
7371

7472
@Setter
@@ -135,10 +133,7 @@ public RemoteData.Builder serialize() {
135133
@Override
136134
protected StorageID id0() {
137135
return new StorageID()
138-
.appendMutant(new String[] {
139-
SERVICE_ID,
140-
NAME
141-
}, IDManager.ServiceInstanceID.buildId(serviceId, name));
136+
.append(IDManager.ServiceInstanceID.buildId(serviceId, name));
142137
}
143138

144139
public static class Builder implements StorageBuilder<InstanceTraffic> {

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/networkalias/NetworkAddressAlias.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,14 @@ public class NetworkAddressAlias extends Metrics {
5555
@Setter
5656
@Getter
5757
@Column(name = ADDRESS)
58-
@BanyanDB.SeriesID(index = 0)
5958
private String address;
6059
@Setter
6160
@Getter
6261
@Column(name = REPRESENT_SERVICE_ID)
63-
@BanyanDB.SeriesID(index = 1)
6462
private String representServiceId;
6563
@Setter
6664
@Getter
6765
@Column(name = REPRESENT_SERVICE_INSTANCE_ID)
68-
@BanyanDB.SeriesID(index = 2)
6966
private String representServiceInstanceId;
7067
@Setter
7168
@Getter
@@ -89,8 +86,7 @@ public boolean combine(final Metrics metrics) {
8986

9087
@Override
9188
protected StorageID id0() {
92-
return new StorageID().appendMutant(
93-
new String[] {ADDRESS}, IDManager.NetworkAddressAliasDefine.buildId(address));
89+
return new StorageID().append(IDManager.NetworkAddressAliasDefine.buildId(address));
9490
}
9591

9692
@Override

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ProcessTraffic.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"instanceId",
5151
"name",
5252
})
53-
@BanyanDB.StoreIDAsTag
5453
@BanyanDB.IndexMode
5554
public class ProcessTraffic extends Metrics {
5655
public static final String INDEX_NAME = "process_traffic";
@@ -74,7 +73,6 @@ public class ProcessTraffic extends Metrics {
7473
@Setter
7574
@Getter
7675
@Column(name = INSTANCE_ID, length = 600)
77-
@BanyanDB.SeriesID(index = 0)
7876
private String instanceId;
7977

8078
@Getter
@@ -84,7 +82,6 @@ public class ProcessTraffic extends Metrics {
8482
@Setter
8583
@Getter
8684
@Column(name = NAME, length = 500)
87-
@BanyanDB.SeriesID(index = 1)
8885
private String name;
8986

9087
@Setter
@@ -196,10 +193,7 @@ protected StorageID id0() {
196193
if (processId == null) {
197194
processId = IDManager.ProcessID.buildId(instanceId, name);
198195
}
199-
return new StorageID().appendMutant(new String[] {
200-
INSTANCE_ID,
201-
NAME
202-
}, processId);
196+
return new StorageID().append(processId);
203197
}
204198

205199
public static class Builder implements StorageBuilder<ProcessTraffic> {

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/process/ServiceLabelRecord.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ public class ServiceLabelRecord extends Metrics {
5555
public static final String SERVICE_ID = "service_id";
5656
public static final String LABEL = "label";
5757

58-
@BanyanDB.SeriesID(index = 0)
5958
@Column(name = SERVICE_ID)
6059
private String serviceId;
61-
@BanyanDB.SeriesID(index = 1)
6260
@Column(name = LABEL, length = 50)
6361
private String label;
6462

@@ -83,9 +81,7 @@ public Metrics toDay() {
8381

8482
@Override
8583
protected StorageID id0() {
86-
return new StorageID()
87-
.append(SERVICE_ID, serviceId)
88-
.append(LABEL, label);
84+
return new StorageID().append(serviceId).append(label);
8985
}
9086

9187
@Override

oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/searchtag/TagAutocompleteData.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,15 @@ public class TagAutocompleteData extends Metrics {
5757
@Getter
5858
@Column(name = TAG_KEY)
5959
@ElasticSearch.EnableDocValues
60-
@BanyanDB.SeriesID(index = 1)
6160
private String tagKey;
6261
@Setter
6362
@Getter
6463
@Column(name = TAG_VALUE, length = Tag.TAG_LENGTH)
65-
@BanyanDB.SeriesID(index = 2)
6664
private String tagValue;
6765

6866
@Setter
6967
@Getter
7068
@Column(name = TAG_TYPE)
71-
@BanyanDB.SeriesID(index = 0)
7269
private String tagType;
7370

7471
@Override
@@ -94,10 +91,10 @@ public Metrics toDay() {
9491
@Override
9592
protected StorageID id0() {
9693
return new StorageID()
97-
.appendMutant(new String[] {TIME_BUCKET}, toTimeBucketInDay())
98-
.append(TAG_TYPE, tagType)
99-
.append(TAG_KEY, tagKey)
100-
.append(TAG_VALUE, tagValue);
94+
.append(toTimeBucketInDay())
95+
.append(tagType)
96+
.append(tagKey)
97+
.append(tagValue);
10198
}
10299

103100
@Override

0 commit comments

Comments
 (0)