This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 32807c8772 BanyanDB: Separate the storage configuration to an
independent file: `bydb.yaml`. (#13097)
32807c8772 is described below
commit 32807c8772ecfcb8403ad9dc877102ed4634bbe7
Author: Wan Kai <[email protected]>
AuthorDate: Wed Mar 12 17:20:09 2025 +0800
BanyanDB: Separate the storage configuration to an independent file:
`bydb.yaml`. (#13097)
---
apm-dist/src/main/assembly/binary.xml | 1 +
docs/en/changes/changes.md | 1 +
docs/en/setup/backend/storages/banyandb.md | 146 ++++++++-------
.../oap/server/library/module/ModuleDefine.java | 39 +---
.../oap/server/library/module/ModuleProvider.java | 2 +-
.../server/library/util/YamlConfigLoaderUtils.java | 99 +++++++++++
oap-server/server-starter/pom.xml | 1 +
.../starter/config/ApplicationConfigLoader.java | 36 +---
.../src/main/resources/application.yml | 67 +------
.../server-starter/src/main/resources/bydb.yml | 89 ++++++++++
.../plugin/banyandb/BanyanDBConfigLoader.java | 119 +++++++++++++
.../plugin/banyandb/BanyanDBStorageClient.java | 4 +-
.../plugin/banyandb/BanyanDBStorageConfig.java | 196 +++++++++++++--------
.../plugin/banyandb/BanyanDBStorageProvider.java | 36 ++--
.../plugin/banyandb/BanyanDBTTLStatusQuery.java | 17 +-
.../storage/plugin/banyandb/MetadataRegistry.java | 30 ++--
.../measure/BanyanDBHierarchyQueryDAO.java | 2 +-
.../banyandb/measure/BanyanDBMetadataQueryDAO.java | 2 +-
.../measure/BanyanDBNetworkAddressAliasDAO.java | 2 +-
.../banyandb/measure/BanyanDBServiceLabelDAO.java | 2 +-
.../server/storage/plugin/banyandb/BanyanDBIT.java | 14 +-
21 files changed, 582 insertions(+), 323 deletions(-)
diff --git a/apm-dist/src/main/assembly/binary.xml
b/apm-dist/src/main/assembly/binary.xml
index ca82e01f38..f03d91ae46 100644
--- a/apm-dist/src/main/assembly/binary.xml
+++ b/apm-dist/src/main/assembly/binary.xml
@@ -61,6 +61,7 @@
<include>trace-sampling-policy-settings.yml</include>
<include>hierarchy-definition.yml</include>
<include>bydb.dependencies.properties</include>
+ <include>bydb.yml</include>
<include>oal/*.oal</include>
<include>fetcher-prom-rules/*.yaml</include>
<include>envoy-metrics-rules/**</include>
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index fa05f8d7f2..a1df1f670b 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -79,6 +79,7 @@
* BanyanDB: fix alarm query result without sort.
* Add a component ID for Virtual thread executor.
* Add more model installation log info for OAP storage initialization.
+* BanyanDB: Separate the storage configuration to an independent file:
`bydb.yaml`.
#### UI
diff --git a/docs/en/setup/backend/storages/banyandb.md
b/docs/en/setup/backend/storages/banyandb.md
index ec5f89e744..91db12c986 100644
--- a/docs/en/setup/backend/storages/banyandb.md
+++ b/docs/en/setup/backend/storages/banyandb.md
@@ -22,76 +22,90 @@
org.apache.skywalking.oap.server.library.module.ModuleStartException: Incompatib
```
### Configuration
+In the `application.yml` file, select the BanyanDB storage provider:
```yaml
storage:
banyandb:
- # Targets is the list of BanyanDB servers, separated by commas.
- # Each target is a BanyanDB server in the format of `host:port`.
- # If BanyanDB is deployed as a standalone server, the target should be the
IP address or domain name and port of the BanyanDB server.
- # If BanyanDB is deployed in a cluster, the targets should be the IP
address or domain name and port of the `liaison` nodes, separated by commas.
- targets: ${SW_STORAGE_BANYANDB_TARGETS:127.0.0.1:17912}
- # The maximum number of records in a bulk write request.
- # A larger value can improve write performance but also increases OAP and
BanyanDB Server memory usage.
- maxBulkSize: ${SW_STORAGE_BANYANDB_MAX_BULK_SIZE:10000}
- # The minimum seconds between two bulk flushes.
- # If the data in a bulk is less than maxBulkSize, the data will be flushed
after this period.
- # If the data in a bulk exceeds maxBulkSize, the data will be flushed
immediately.
- # A larger value can reduce write pressure on BanyanDB Server but increase
data latency.
- flushInterval: ${SW_STORAGE_BANYANDB_FLUSH_INTERVAL:15}
- # The timeout in seconds for a bulk flush.
- flushTimeout: ${SW_STORAGE_BANYANDB_FLUSH_TIMEOUT:10}
- # The number of threads that write data to BanyanDB concurrently.
- # A higher value can improve write performance but also increases CPU
usage on both OAP and BanyanDB Server.
- concurrentWriteThreads: ${SW_STORAGE_BANYANDB_CONCURRENT_WRITE_THREADS:15}
- # The maximum size of the dataset when the OAP loads cache, such as
network aliases.
- resultWindowMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_WINDOW_SIZE:10000}
- # The maximum size of metadata per query.
- metadataQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_SIZE:10000}
- # The maximum number of trace segments per query.
- segmentQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_SEGMENT_SIZE:200}
- # The maximum number of profile task queries in a request.
- profileTaskQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_PROFILE_TASK_SIZE:200}
- # The batch size for querying profile data.
- profileDataQueryBatchSize:
${SW_STORAGE_BANYANDB_QUERY_PROFILE_DATA_BATCH_SIZE:100}
- # If the BanyanDB server is configured with TLS, configure the TLS cert
file path and enable TLS connection.
- sslTrustCAPath: ${SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH:""}
- # The group settings of record.
- # `gr` is the short name of the group settings of record.
- #
- # The "normal" section defines settings for datasets not specified in
"super".
- # Each dataset will be grouped under a single group named "normal".
- grNormalShardNum: ${SW_STORAGE_BANYANDB_GR_NORMAL_SHARD_NUM:1}
- grNormalSIDays: ${SW_STORAGE_BANYANDB_GR_NORMAL_SI_DAYS:1}
- grNormalTTLDays: ${SW_STORAGE_BANYANDB_GR_NORMAL_TTL_DAYS:3}
- # "super" is a special dataset designed to store trace or log data that is
too large for normal datasets.
- # Each super dataset will be a separate group in BanyanDB, following the
settings defined in the "super" section.
- grSuperShardNum: ${SW_STORAGE_BANYANDB_GR_SUPER_SHARD_NUM:2}
- grSuperSIDays: ${SW_STORAGE_BANYANDB_GR_SUPER_SI_DAYS:1}
- grSuperTTLDays: ${SW_STORAGE_BANYANDB_GR_SUPER_TTL_DAYS:3}
- # The group settings of metrics.
- # `gm` is the short name of the group settings of metrics.
- #
- # OAP stores metrics based its granularity.
- # Valid values are "day", "hour", and "minute". That means metrics will be
stored in the three separate groups.
- # Non-"minute" are governed by the "core.downsampling" setting.
- # For example, if "core.downsampling" is set to "hour", the "hour" will be
used, while "day" are ignored.
- gmMinuteShardNum: ${SW_STORAGE_BANYANDB_GM_MINUTE_SHARD_NUM:2}
- gmMinuteSIDays: ${SW_STORAGE_BANYANDB_GM_MINUTE_SI_DAYS:1}
- gmMinuteTTLDays: ${SW_STORAGE_BANYANDB_GM_MINUTE_TTL_DAYS:7}
- gmHourShardNum: ${SW_STORAGE_BANYANDB_GM_HOUR_SHARD_NUM:1}
- gmHourSIDays: ${SW_STORAGE_BANYANDB_GM_HOUR_SI_DAYS:5}
- gmHourTTLDays: ${SW_STORAGE_BANYANDB_GM_HOUR_TTL_DAYS:15}
- gmDayShardNum: ${SW_STORAGE_BANYANDB_GM_DAY_SHARD_NUM:1}
- gmDaySIDays: ${SW_STORAGE_BANYANDB_GM_DAY_SI_DAYS:15}
- gmDayTTLDays: ${SW_STORAGE_BANYANDB_GM_DAY_TTL_DAYS:15}
- # If the metrics is marked as "index_mode", the metrics will be stored in
the "index" group.
- # The "index" group is designed to store metrics that are used for
indexing without value columns.
- # Such as `service_traffic`, `network_address_alias`, etc.
- # "index_mode" requires BanyanDB *0.8.0* or later.
- gmIndexShardNum: ${SW_STORAGE_BANYANDB_GM_INDEX_SHARD_NUM:2}
- gmIndexSIDays: ${SW_STORAGE_BANYANDB_GM_INDEX_SI_DAYS:15}
- gmIndexTTLDays: ${SW_STORAGE_BANYANDB_GM_INDEX_TTL_DAYS:15}
+```
+
+Since 10.2.0, the banyandb configuration is separated to an independent
configuration file: `bydb.yaml`:
+
+```yaml
+global:
+ # Targets is the list of BanyanDB servers, separated by commas.
+ # Each target is a BanyanDB server in the format of `host:port`.
+ # If BanyanDB is deployed as a standalone server, the target should be the
IP address or domain name and port of the BanyanDB server.
+ # If BanyanDB is deployed in a cluster, the targets should be the IP address
or domain name and port of the `liaison` nodes, separated by commas.
+ targets: ${SW_STORAGE_BANYANDB_TARGETS:127.0.0.1:17912}
+ # The maximum number of records in a bulk write request.
+ # A larger value can improve write performance but also increases OAP and
BanyanDB Server memory usage.
+ maxBulkSize: ${SW_STORAGE_BANYANDB_MAX_BULK_SIZE:10000}
+ # The minimum seconds between two bulk flushes.
+ # If the data in a bulk is less than maxBulkSize, the data will be flushed
after this period.
+ # If the data in a bulk exceeds maxBulkSize, the data will be flushed
immediately.
+ # A larger value can reduce write pressure on BanyanDB Server but increase
data latency.
+ flushInterval: ${SW_STORAGE_BANYANDB_FLUSH_INTERVAL:15}
+ # The timeout in seconds for a bulk flush.
+ flushTimeout: ${SW_STORAGE_BANYANDB_FLUSH_TIMEOUT:10}
+ # The number of threads that write data to BanyanDB concurrently.
+ # A higher value can improve write performance but also increases CPU usage
on both OAP and BanyanDB Server.
+ concurrentWriteThreads: ${SW_STORAGE_BANYANDB_CONCURRENT_WRITE_THREADS:15}
+ # The maximum size of the dataset when the OAP loads cache, such as network
aliases.
+ resultWindowMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_WINDOW_SIZE:10000}
+ # The maximum size of metadata per query.
+ metadataQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_SIZE:10000}
+ # The maximum number of trace segments per query.
+ segmentQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_SEGMENT_SIZE:200}
+ # The maximum number of profile task queries in a request.
+ profileTaskQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_PROFILE_TASK_SIZE:200}
+ # The batch size for querying profile data.
+ profileDataQueryBatchSize:
${SW_STORAGE_BANYANDB_QUERY_PROFILE_DATA_BATCH_SIZE:100}
+ asyncProfilerTaskQueryMaxSize:
${SW_STORAGE_BANYANDB_ASYNC_PROFILER_TASK_QUERY_MAX_SIZE:200}
+ # If the BanyanDB server is configured with TLS, configure the TLS cert file
path and enable TLS connection.
+ sslTrustCAPath: ${SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH:""}
+
+groups:
+ # The group settings of record.
+ #
+ # The "normal" section defines settings for datasets not specified in
"super".
+ # Each dataset will be grouped under a single group named "normal".
+ recordsNormal:
+ shardNum: ${SW_STORAGE_BANYANDB_GR_NORMAL_SHARD_NUM:1}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GR_NORMAL_SI_DAYS:1}
+ ttl: ${SW_STORAGE_BANYANDB_GR_NORMAL_TTL_DAYS:3}
+ # "super" is a special dataset designed to store trace or log data that is
too large for normal datasets.
+ # Each super dataset will be a separate group in BanyanDB, following the
settings defined in the "super" section.
+ recordsSuper:
+ shardNum: ${SW_STORAGE_BANYANDB_GR_SUPER_SHARD_NUM:2}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GR_SUPER_SI_DAYS:1}
+ ttl: ${SW_STORAGE_BANYANDB_GR_SUPER_TTL_DAYS:3}
+ # The group settings of metrics.
+ #
+ # OAP stores metrics based its granularity.
+ # Valid values are "day", "hour", and "minute". That means metrics will be
stored in the three separate groups.
+ # Non-"minute" are governed by the "core.downsampling" setting.
+ # For example, if "core.downsampling" is set to "hour", the "hour" will be
used, while "day" are ignored.
+ metricsMin:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_MINUTE_SHARD_NUM:2}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_MINUTE_SI_DAYS:1}
+ ttl: ${SW_STORAGE_BANYANDB_GM_MINUTE_TTL_DAYS:7}
+ metricsHour:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_HOUR_SHARD_NUM:1}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_HOUR_SI_DAYS:5}
+ ttl: ${SW_STORAGE_BANYANDB_GM_HOUR_TTL_DAYS:15}
+ metricsDay:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_DAY_SHARD_NUM:1}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_DAY_SI_DAYS:15}
+ ttl: ${SW_STORAGE_BANYANDB_GM_DAY_TTL_DAYS:15}
+ # If the metrics is marked as "index_mode", the metrics will be stored in
the "index" group.
+ # The "index" group is designed to store metrics that are used for indexing
without value columns.
+ # Such as `service_traffic`, `network_address_alias`, etc.
+ # "index_mode" requires BanyanDB *0.8.0* or later.
+ metadata:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_INDEX_SHARD_NUM:2}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_INDEX_SI_DAYS:15}
+ ttl: ${SW_STORAGE_BANYANDB_GM_INDEX_TTL_DAYS:15}
```
diff --git
a/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleDefine.java
b/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleDefine.java
index a26ce2912c..e12d3d7a60 100644
---
a/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleDefine.java
+++
b/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleDefine.java
@@ -18,14 +18,13 @@
package org.apache.skywalking.oap.server.library.module;
-import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
-import java.util.Enumeration;
-import java.util.Properties;
import java.util.ServiceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static
org.apache.skywalking.oap.server.library.util.YamlConfigLoaderUtils.copyProperties;
+
/**
* A module definition.
*/
@@ -113,40 +112,6 @@ public abstract class ModuleDefine implements
ModuleProviderHolder {
loadedProvider.prepare();
}
- private void copyProperties(ModuleConfig dest, Properties src, String
moduleName,
- String providerName) throws
IllegalAccessException {
- if (dest == null) {
- return;
- }
- Enumeration<?> propertyNames = src.propertyNames();
- while (propertyNames.hasMoreElements()) {
- String propertyName = (String) propertyNames.nextElement();
- Class<? extends ModuleConfig> destClass = dest.getClass();
- try {
- Field field = getDeclaredField(destClass, propertyName);
- field.setAccessible(true);
- field.set(dest, src.get(propertyName));
- } catch (NoSuchFieldException e) {
- LOGGER.warn(
- propertyName + " setting is not supported in " +
providerName + " provider of " + moduleName + " module");
- }
- }
- }
-
- private Field getDeclaredField(Class<?> destClass, String fieldName)
throws NoSuchFieldException {
- if (destClass != null) {
- Field[] fields = destClass.getDeclaredFields();
- for (Field field : fields) {
- if (field.getName().equals(fieldName)) {
- return field;
- }
- }
- return getDeclaredField(destClass.getSuperclass(), fieldName);
- }
-
- throw new NoSuchFieldException();
- }
-
@Override
public final ModuleProvider provider() throws DuplicateProviderException,
ProviderNotFoundException {
if (loadedProvider == null) {
diff --git
a/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleProvider.java
b/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleProvider.java
index c128b23f96..6eeed9145d 100644
---
a/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleProvider.java
+++
b/oap-server/server-library/library-module/src/main/java/org/apache/skywalking/oap/server/library/module/ModuleProvider.java
@@ -143,7 +143,7 @@ public abstract class ModuleProvider implements
ModuleServiceHolder {
throw new ServiceNotProvidedException("Service " +
serviceType.getName() + " should not be provided, based on moduleDefine
define.");
}
- ModuleDefine getModule() {
+ public ModuleDefine getModule() {
return moduleDefine;
}
diff --git
a/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/YamlConfigLoaderUtils.java
b/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/YamlConfigLoaderUtils.java
new file mode 100644
index 0000000000..15a5321347
--- /dev/null
+++
b/oap-server/server-library/library-util/src/main/java/org/apache/skywalking/oap/server/library/util/YamlConfigLoaderUtils.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.library.util;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Properties;
+import lombok.extern.slf4j.Slf4j;
+import org.yaml.snakeyaml.Yaml;
+
+@Slf4j
+public class YamlConfigLoaderUtils {
+
+ public static void replacePropertyAndLog(final String propertyName,
+ final Object propertyValue,
+ final Properties target,
+ final Object providerName,
+ final Yaml yaml) {
+ final String valueString =
PropertyPlaceholderHelper.INSTANCE.replacePlaceholders(
+ String.valueOf(propertyValue), target);
+ if (valueString.trim().length() == 0) {
+ target.replace(propertyName, valueString);
+ log.info("Provider={} config={} has been set as an empty string",
providerName, propertyName);
+ } else {
+ // Use YAML to do data type conversion.
+ final Object replaceValue = convertValueString(valueString, yaml);
+ if (replaceValue != null) {
+ target.replace(propertyName, replaceValue);
+ }
+ }
+ }
+
+ public static Object convertValueString(final String valueString, final
Yaml yaml) {
+ try {
+ Object replaceValue = yaml.load(valueString);
+ if (replaceValue instanceof String || replaceValue instanceof
Integer || replaceValue instanceof Long || replaceValue instanceof Boolean ||
replaceValue instanceof ArrayList) {
+ return replaceValue;
+ } else {
+ return valueString;
+ }
+ } catch (Exception e) {
+ log.warn("yaml convert value type error, use origin values string.
valueString={}", valueString, e);
+ return valueString;
+ }
+ }
+
+ public static void copyProperties(final Object dest,
+ final Properties src,
+ final String moduleName,
+ final String providerName) throws
IllegalAccessException {
+ if (dest == null) {
+ return;
+ }
+ Enumeration<?> propertyNames = src.propertyNames();
+ while (propertyNames.hasMoreElements()) {
+ String propertyName = (String) propertyNames.nextElement();
+ Class<?> destClass = dest.getClass();
+ try {
+ Field field = getDeclaredField(destClass, propertyName);
+ field.setAccessible(true);
+ field.set(dest, src.get(propertyName));
+ } catch (NoSuchFieldException e) {
+ log.warn(
+ propertyName + " setting is not supported in " +
providerName + " provider of " + moduleName + " module");
+ }
+ }
+ }
+
+ public static Field getDeclaredField(final Class<?> destClass, final
String fieldName) throws NoSuchFieldException {
+ if (destClass != null) {
+ Field[] fields = destClass.getDeclaredFields();
+ for (Field field : fields) {
+ if (field.getName().equals(fieldName)) {
+ return field;
+ }
+ }
+ return getDeclaredField(destClass.getSuperclass(), fieldName);
+ }
+
+ throw new NoSuchFieldException();
+ }
+}
diff --git a/oap-server/server-starter/pom.xml
b/oap-server/server-starter/pom.xml
index 51f79f3fc6..2b06383038 100644
--- a/oap-server/server-starter/pom.xml
+++ b/oap-server/server-starter/pom.xml
@@ -316,6 +316,7 @@
<exclude>trace-sampling-policy-settings.yml</exclude>
<exclude>hierarchy-definition.yml</exclude>
<exclude>bydb.dependencies.properties</exclude>
+ <exclude>bydb.yml</exclude>
<exclude>oal/</exclude>
<exclude>fetcher-prom-rules/</exclude>
<exclude>envoy-metrics-rules/</exclude>
diff --git
a/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
b/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
index e7f572c3cf..250692f25d 100644
---
a/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
+++
b/oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
@@ -36,6 +36,8 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
+import static
org.apache.skywalking.oap.server.library.util.YamlConfigLoaderUtils.replacePropertyAndLog;
+
/**
* Initialize collector settings with following sources. Use application.yml
as primary setting, and fix missing setting
* by default settings in application-default.yml.
@@ -92,12 +94,12 @@ public class ApplicationConfigLoader implements
ConfigLoader<ApplicationConfigur
Properties subProperties = new
Properties();
((Map<String, ?>)
propertyValue).forEach((key, value) -> {
subProperties.put(key, value);
- replacePropertyAndLog(key, value,
subProperties, providerName);
+ replacePropertyAndLog(key, value,
subProperties, providerName, yaml);
});
properties.put(propertyName,
subProperties);
} else {
properties.put(propertyName,
propertyValue);
- replacePropertyAndLog(propertyName,
propertyValue, properties, providerName);
+ replacePropertyAndLog(propertyName,
propertyValue, properties, providerName, yaml);
}
});
}
@@ -117,36 +119,6 @@ public class ApplicationConfigLoader implements
ConfigLoader<ApplicationConfigur
}
}
- private void replacePropertyAndLog(final String propertyName, final Object
propertyValue, final Properties target,
- final Object providerName) {
- final String valueString = PropertyPlaceholderHelper.INSTANCE
- .replacePlaceholders(String.valueOf(propertyValue), target);
- if (valueString.trim().length() == 0) {
- target.replace(propertyName, valueString);
- log.info("Provider={} config={} has been set as an empty string",
providerName, propertyName);
- } else {
- // Use YAML to do data type conversion.
- final Object replaceValue = convertValueString(valueString);
- if (replaceValue != null) {
- target.replace(propertyName, replaceValue);
- }
- }
- }
-
- private Object convertValueString(String valueString) {
- try {
- Object replaceValue = yaml.load(valueString);
- if (replaceValue instanceof String || replaceValue instanceof
Integer || replaceValue instanceof Long || replaceValue instanceof Boolean ||
replaceValue instanceof ArrayList) {
- return replaceValue;
- } else {
- return valueString;
- }
- } catch (Exception e) {
- log.warn("yaml convert value type error, use origin values string.
valueString={}", valueString, e);
- return valueString;
- }
- }
-
private void overrideConfigBySystemEnv(ApplicationConfiguration
configuration) {
for (Map.Entry<Object, Object> prop :
System.getProperties().entrySet()) {
overrideModuleSettings(configuration, prop.getKey().toString(),
prop.getValue().toString());
diff --git a/oap-server/server-starter/src/main/resources/application.yml
b/oap-server/server-starter/src/main/resources/application.yml
index fec8ae04b1..925c268a9c 100644
--- a/oap-server/server-starter/src/main/resources/application.yml
+++ b/oap-server/server-starter/src/main/resources/application.yml
@@ -148,72 +148,7 @@ core:
storage:
selector: ${SW_STORAGE:banyandb}
banyandb:
- # Targets is the list of BanyanDB servers, separated by commas.
- # Each target is a BanyanDB server in the format of `host:port`.
- # If BanyanDB is deployed as a standalone server, the target should be the
IP address or domain name and port of the BanyanDB server.
- # If BanyanDB is deployed in a cluster, the targets should be the IP
address or domain name and port of the `liaison` nodes, separated by commas.
- targets: ${SW_STORAGE_BANYANDB_TARGETS:127.0.0.1:17912}
- # The maximum number of records in a bulk write request.
- # A larger value can improve write performance but also increases OAP and
BanyanDB Server memory usage.
- maxBulkSize: ${SW_STORAGE_BANYANDB_MAX_BULK_SIZE:10000}
- # The minimum seconds between two bulk flushes.
- # If the data in a bulk is less than maxBulkSize, the data will be flushed
after this period.
- # If the data in a bulk exceeds maxBulkSize, the data will be flushed
immediately.
- # A larger value can reduce write pressure on BanyanDB Server but increase
data latency.
- flushInterval: ${SW_STORAGE_BANYANDB_FLUSH_INTERVAL:15}
- # The timeout in seconds for a bulk flush.
- flushTimeout: ${SW_STORAGE_BANYANDB_FLUSH_TIMEOUT:10}
- # The number of threads that write data to BanyanDB concurrently.
- # A higher value can improve write performance but also increases CPU
usage on both OAP and BanyanDB Server.
- concurrentWriteThreads: ${SW_STORAGE_BANYANDB_CONCURRENT_WRITE_THREADS:15}
- # The maximum size of the dataset when the OAP loads cache, such as
network aliases.
- resultWindowMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_WINDOW_SIZE:10000}
- # The maximum size of metadata per query.
- metadataQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_SIZE:10000}
- # The maximum number of trace segments per query.
- segmentQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_SEGMENT_SIZE:200}
- # The maximum number of profile task queries in a request.
- profileTaskQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_PROFILE_TASK_SIZE:200}
- # The batch size for querying profile data.
- profileDataQueryBatchSize:
${SW_STORAGE_BANYANDB_QUERY_PROFILE_DATA_BATCH_SIZE:100}
- # If the BanyanDB server is configured with TLS, configure the TLS cert
file path and enable TLS connection.
- sslTrustCAPath: ${SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH:""}
- # The group settings of record.
- # `gr` is the short name of the group settings of record.
- #
- # The "normal" section defines settings for datasets not specified in
"super".
- # Each dataset will be grouped under a single group named "normal".
- grNormalShardNum: ${SW_STORAGE_BANYANDB_GR_NORMAL_SHARD_NUM:1}
- grNormalSIDays: ${SW_STORAGE_BANYANDB_GR_NORMAL_SI_DAYS:1}
- grNormalTTLDays: ${SW_STORAGE_BANYANDB_GR_NORMAL_TTL_DAYS:3}
- # "super" is a special dataset designed to store trace or log data that is
too large for normal datasets.
- # Each super dataset will be a separate group in BanyanDB, following the
settings defined in the "super" section.
- grSuperShardNum: ${SW_STORAGE_BANYANDB_GR_SUPER_SHARD_NUM:2}
- grSuperSIDays: ${SW_STORAGE_BANYANDB_GR_SUPER_SI_DAYS:1}
- grSuperTTLDays: ${SW_STORAGE_BANYANDB_GR_SUPER_TTL_DAYS:3}
- # The group settings of metrics.
- # `gm` is the short name of the group settings of metrics.
- #
- # OAP stores metrics based its granularity.
- # Valid values are "day", "hour", and "minute". That means metrics will be
stored in the three separate groups.
- # Non-"minute" are governed by the "core.downsampling" setting.
- # For example, if "core.downsampling" is set to "hour", the "hour" will be
used, while "day" are ignored.
- gmMinuteShardNum: ${SW_STORAGE_BANYANDB_GM_MINUTE_SHARD_NUM:2}
- gmMinuteSIDays: ${SW_STORAGE_BANYANDB_GM_MINUTE_SI_DAYS:1}
- gmMinuteTTLDays: ${SW_STORAGE_BANYANDB_GM_MINUTE_TTL_DAYS:7}
- gmHourShardNum: ${SW_STORAGE_BANYANDB_GM_HOUR_SHARD_NUM:1}
- gmHourSIDays: ${SW_STORAGE_BANYANDB_GM_HOUR_SI_DAYS:5}
- gmHourTTLDays: ${SW_STORAGE_BANYANDB_GM_HOUR_TTL_DAYS:15}
- gmDayShardNum: ${SW_STORAGE_BANYANDB_GM_DAY_SHARD_NUM:1}
- gmDaySIDays: ${SW_STORAGE_BANYANDB_GM_DAY_SI_DAYS:15}
- gmDayTTLDays: ${SW_STORAGE_BANYANDB_GM_DAY_TTL_DAYS:15}
- # If the metrics is marked as "index_mode", the metrics will be stored in
the "index" group.
- # The "index" group is designed to store metrics that are used for
indexing without value columns.
- # Such as `service_traffic`, `network_address_alias`, etc.
- # "index_mode" requires BanyanDB *0.8.0* or later.
- gmIndexShardNum: ${SW_STORAGE_BANYANDB_GM_INDEX_SHARD_NUM:2}
- gmIndexSIDays: ${SW_STORAGE_BANYANDB_GM_INDEX_SI_DAYS:15}
- gmIndexTTLDays: ${SW_STORAGE_BANYANDB_GM_INDEX_TTL_DAYS:15}
+ # Since 10.2.0, the banyandb configuration is separated to an independent
configuration file: `bydb.yaml`.
elasticsearch:
namespace: ${SW_NAMESPACE:""}
clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:localhost:9200}
diff --git a/oap-server/server-starter/src/main/resources/bydb.yml
b/oap-server/server-starter/src/main/resources/bydb.yml
new file mode 100644
index 0000000000..3cfdb7da5a
--- /dev/null
+++ b/oap-server/server-starter/src/main/resources/bydb.yml
@@ -0,0 +1,89 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+global:
+ # Targets is the list of BanyanDB servers, separated by commas.
+ # Each target is a BanyanDB server in the format of `host:port`.
+ # If BanyanDB is deployed as a standalone server, the target should be the
IP address or domain name and port of the BanyanDB server.
+ # If BanyanDB is deployed in a cluster, the targets should be the IP address
or domain name and port of the `liaison` nodes, separated by commas.
+ targets: ${SW_STORAGE_BANYANDB_TARGETS:127.0.0.1:17912}
+ # The maximum number of records in a bulk write request.
+ # A larger value can improve write performance but also increases OAP and
BanyanDB Server memory usage.
+ maxBulkSize: ${SW_STORAGE_BANYANDB_MAX_BULK_SIZE:10000}
+ # The minimum seconds between two bulk flushes.
+ # If the data in a bulk is less than maxBulkSize, the data will be flushed
after this period.
+ # If the data in a bulk exceeds maxBulkSize, the data will be flushed
immediately.
+ # A larger value can reduce write pressure on BanyanDB Server but increase
data latency.
+ flushInterval: ${SW_STORAGE_BANYANDB_FLUSH_INTERVAL:15}
+ # The timeout in seconds for a bulk flush.
+ flushTimeout: ${SW_STORAGE_BANYANDB_FLUSH_TIMEOUT:10}
+ # The number of threads that write data to BanyanDB concurrently.
+ # A higher value can improve write performance but also increases CPU usage
on both OAP and BanyanDB Server.
+ concurrentWriteThreads: ${SW_STORAGE_BANYANDB_CONCURRENT_WRITE_THREADS:15}
+ # The maximum size of the dataset when the OAP loads cache, such as network
aliases.
+ resultWindowMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_WINDOW_SIZE:10000}
+ # The maximum size of metadata per query.
+ metadataQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_MAX_SIZE:10000}
+ # The maximum number of trace segments per query.
+ segmentQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_SEGMENT_SIZE:200}
+ # The maximum number of profile task queries in a request.
+ profileTaskQueryMaxSize: ${SW_STORAGE_BANYANDB_QUERY_PROFILE_TASK_SIZE:200}
+ # The batch size for querying profile data.
+ profileDataQueryBatchSize:
${SW_STORAGE_BANYANDB_QUERY_PROFILE_DATA_BATCH_SIZE:100}
+ asyncProfilerTaskQueryMaxSize:
${SW_STORAGE_BANYANDB_ASYNC_PROFILER_TASK_QUERY_MAX_SIZE:200}
+ # If the BanyanDB server is configured with TLS, configure the TLS cert file
path and enable TLS connection.
+ sslTrustCAPath: ${SW_STORAGE_BANYANDB_SSL_TRUST_CA_PATH:""}
+
+groups:
+ # The group settings of record.
+ #
+ # The "normal" section defines settings for datasets not specified in
"super".
+ # Each dataset will be grouped under a single group named "normal".
+ recordsNormal:
+ shardNum: ${SW_STORAGE_BANYANDB_GR_NORMAL_SHARD_NUM:1}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GR_NORMAL_SI_DAYS:1}
+ ttl: ${SW_STORAGE_BANYANDB_GR_NORMAL_TTL_DAYS:3}
+ # "super" is a special dataset designed to store trace or log data that is
too large for normal datasets.
+ # Each super dataset will be a separate group in BanyanDB, following the
settings defined in the "super" section.
+ recordsSuper:
+ shardNum: ${SW_STORAGE_BANYANDB_GR_SUPER_SHARD_NUM:2}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GR_SUPER_SI_DAYS:1}
+ ttl: ${SW_STORAGE_BANYANDB_GR_SUPER_TTL_DAYS:3}
+ # The group settings of metrics.
+ #
+ # OAP stores metrics based its granularity.
+ # Valid values are "day", "hour", and "minute". That means metrics will be
stored in the three separate groups.
+ # Non-"minute" are governed by the "core.downsampling" setting.
+ # For example, if "core.downsampling" is set to "hour", the "hour" will be
used, while "day" are ignored.
+ metricsMin:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_MINUTE_SHARD_NUM:2}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_MINUTE_SI_DAYS:1}
+ ttl: ${SW_STORAGE_BANYANDB_GM_MINUTE_TTL_DAYS:7}
+ metricsHour:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_HOUR_SHARD_NUM:1}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_HOUR_SI_DAYS:5}
+ ttl: ${SW_STORAGE_BANYANDB_GM_HOUR_TTL_DAYS:15}
+ metricsDay:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_DAY_SHARD_NUM:1}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_DAY_SI_DAYS:15}
+ ttl: ${SW_STORAGE_BANYANDB_GM_DAY_TTL_DAYS:15}
+ # If the metrics is marked as "index_mode", the metrics will be stored in
the "index" group.
+ # The "index" group is designed to store metrics that are used for indexing
without value columns.
+ # Such as `service_traffic`, `network_address_alias`, etc.
+ # "index_mode" requires BanyanDB *0.8.0* or later.
+ metadata:
+ shardNum: ${SW_STORAGE_BANYANDB_GM_INDEX_SHARD_NUM:2}
+ segmentInterval: ${SW_STORAGE_BANYANDB_GM_INDEX_SI_DAYS:15}
+ ttl: ${SW_STORAGE_BANYANDB_GM_INDEX_TTL_DAYS:15}
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java
new file mode 100644
index 0000000000..34036ab4a6
--- /dev/null
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.storage.plugin.banyandb;
+
+import java.io.FileNotFoundException;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.skywalking.oap.server.library.module.ModuleProvider;
+import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+import org.apache.skywalking.oap.server.library.util.ResourceUtils;
+import org.yaml.snakeyaml.Yaml;
+
+import static
org.apache.skywalking.oap.server.library.util.YamlConfigLoaderUtils.copyProperties;
+import static
org.apache.skywalking.oap.server.library.util.YamlConfigLoaderUtils.replacePropertyAndLog;
+
+@Slf4j
+public class BanyanDBConfigLoader {
+ private final ModuleProvider moduleProvider;
+ private final Yaml yaml;
+
+ public BanyanDBConfigLoader(final ModuleProvider moduleProvider) {
+ this.moduleProvider = moduleProvider;
+ this.yaml = new Yaml();
+ }
+
+ public BanyanDBStorageConfig loadConfig() throws ModuleStartException {
+ BanyanDBStorageConfig config = new BanyanDBStorageConfig();
+ Reader applicationReader = null;
+ try {
+ applicationReader = ResourceUtils.read("bydb.yml");
+ } catch (FileNotFoundException e) {
+ throw new ModuleStartException("Cannot find the BanyanDB
configuration file [bydb.yml].", e);
+ }
+ Map<String, Map<String, ?>> configMap = yaml.loadAs(applicationReader,
Map.class);
+ if (configMap == null) {
+ return config;
+ }
+
+ Map<String, Properties> configProperties = new HashMap<>();
+ configMap.forEach((part, c) -> {
+ final Properties properties = new Properties();
+ if (c != null) {
+ for (Map.Entry<String, ?> entry : c.entrySet()) {
+ String propertyName = entry.getKey();
+ Object propertyValue = entry.getValue();
+ if (propertyValue instanceof Map) {
+ Properties subProperties = new Properties();
+ for (Map.Entry<String, ?> e : ((Map<String, ?>)
propertyValue).entrySet()) {
+ String key = e.getKey();
+ Object value = e.getValue();
+ subProperties.put(key, value);
+ replacePropertyAndLog(key, value, subProperties,
this.moduleProvider.name(), yaml);
+ }
+ properties.put(propertyName, subProperties);
+ } else {
+ properties.put(propertyName, propertyValue);
+ replacePropertyAndLog(
+ propertyName, propertyValue, properties,
this.moduleProvider.name(), yaml);
+ }
+ }
+ configProperties.put(part, properties);
+ }
+ });
+
+ try {
+ copyProperties(
+ config.getGlobal(), configProperties.get("global"),
moduleProvider.getModule().name(),
+ moduleProvider.name()
+ );
+ Properties groups = configProperties.get("groups");
+ copyProperties(
+ config.getRecordsNormal(), (Properties)
groups.get("recordsNormal"),
+ moduleProvider.getModule().name(), moduleProvider.name()
+ );
+ copyProperties(
+ config.getRecordsSuper(), (Properties)
groups.get("recordsSuper"),
+ moduleProvider.getModule().name(), moduleProvider.name()
+ );
+ copyProperties(
+ config.getMetricsMin(), (Properties) groups.get("metricsMin"),
+ moduleProvider.getModule().name(), moduleProvider.name()
+ );
+ copyProperties(
+ config.getMetricsHour(), (Properties)
groups.get("metricsHour"),
+ moduleProvider.getModule().name(), moduleProvider.name()
+ );
+ copyProperties(
+ config.getMetricsDay(), (Properties) groups.get("metricsDay"),
+ moduleProvider.getModule().name(), moduleProvider.name()
+ );
+ copyProperties(
+ config.getMetadata(), (Properties) groups.get("metadata"),
+ moduleProvider.getModule().name(), moduleProvider.name()
+ );
+ } catch (IllegalAccessException e) {
+ throw new ModuleStartException("Failed to load BanyanDB
configuration.", e);
+ }
+ return config;
+ }
+}
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java
index ec9ab429ab..b2fb795691 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageClient.java
@@ -69,9 +69,9 @@ public class BanyanDBStorageClient implements Client,
HealthCheckable {
public BanyanDBStorageClient(BanyanDBStorageConfig config) {
Options options = new Options();
- options.setSslTrustCAPath(config.getSslTrustCAPath());
+ options.setSslTrustCAPath(config.getGlobal().getSslTrustCAPath());
this.client = new BanyanDBClient(config.getTargetArray(), options);
- this.flushTimeout = config.getFlushTimeout();
+ this.flushTimeout = config.getGlobal().getFlushTimeout();
}
@Override
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageConfig.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageConfig.java
index 9ad6c03d79..373ff6f06b 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageConfig.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageConfig.java
@@ -27,89 +27,145 @@ import
org.apache.skywalking.oap.server.library.module.ModuleConfig;
@Getter
@Setter
public class BanyanDBStorageConfig extends ModuleConfig {
- /**
- * A comma-separated list of BanyanDB targets.
- *
- * @since 9.7.0
- */
- private String targets = "127.0.0.1:17912";
- /**
- * The maximum size of write entities in a single batch write call.
- */
- private int maxBulkSize = 5000;
- /**
- * Period of flush interval. In the timeunit of seconds.
- */
- private int flushInterval = 15;
- /**
- * Timeout of flush. In the timeunit of seconds.
- */
- private int flushTimeout = 10;
- /**
- * Concurrent consumer threads for batch writing.
- */
- private int concurrentWriteThreads = 2;
- /**
- * Max size of {@link
org.apache.skywalking.oap.server.core.query.type.ProfileTask} to be fetched
- * in a single request.
- */
- private int profileTaskQueryMaxSize;
+ private Global global = new Global();
+ private RecordsNormal recordsNormal = new RecordsNormal();
+ private RecordsSuper recordsSuper = new RecordsSuper();
+ private MetricsMin metricsMin = new MetricsMin();
+ private MetricsHour metricsHour = new MetricsHour();
+ private MetricsDay metricsDay = new MetricsDay();
+ private Metadata metadata = new Metadata();
+
+ public String[] getTargetArray() {
+ return Iterables.toArray(
+
Splitter.on(",").omitEmptyStrings().trimResults().split(this.global.targets),
String.class);
+ }
+
+ @Getter
+ @Setter
+ public static class Global {
+ /**
+ * A comma-separated list of BanyanDB targets.
+ *
+ * @since 9.7.0
+ */
+ private String targets = "127.0.0.1:17912";
+ /**
+ * The maximum size of write entities in a single batch write call.
+ */
+ private int maxBulkSize = 5000;
+ /**
+ * Period of flush interval. In the timeunit of seconds.
+ */
+ private int flushInterval = 15;
+ /**
+ * Timeout of flush. In the timeunit of seconds.
+ */
+ private int flushTimeout = 10;
+ /**
+ * Concurrent consumer threads for batch writing.
+ */
+ private int concurrentWriteThreads = 2;
+ /**
+ * Max size of {@link
org.apache.skywalking.oap.server.core.query.type.ProfileTask} to be fetched in
a single
+ * request.
+ */
+ private int profileTaskQueryMaxSize;
+
+ /**
+ * If the BanyanDB server is configured with TLS, config the TLS cert
file path and open tls connection.
+ */
+ private String sslTrustCAPath = "";
+ /**
+ * Max size of {@link
org.apache.skywalking.oap.server.core.query.type.AsyncProfilerTask} to be
fetched in a
+ * single request.
+ */
+ private int asyncProfilerTaskQueryMaxSize;
+
+ private int resultWindowMaxSize = 10000;
+ private int metadataQueryMaxSize = 5000;
+ private int segmentQueryMaxSize = 200;
+ private int profileDataQueryBatchSize = 100;
+ }
+
+ // The configuration of the groups.
+ // since 10.2.0
+ //The group settings of records.
/**
- * If the BanyanDB server is configured with TLS, config the TLS cert file
path and open tls connection.
+ * The RecordsNormal defines settings for datasets not specified in
"super".
+ * Each dataset will be grouped under a single group named "normal".
*/
- private String sslTrustCAPath = "";
+ @Getter
+ @Setter
+ public static class RecordsNormal {
+ private int shardNum = 1;
+ private int segmentInterval = 1;
+ private int ttl = 3;
+ }
+
/**
- * Max size of {@link
org.apache.skywalking.oap.server.core.query.type.AsyncProfilerTask} to be
fetched
- * in a single request.
+ * RecordsSuper is a special dataset designed to store trace or log data
that is too large for normal datasets.
+ * Each super dataset will be a separate group in BanyanDB.
*/
- private int asyncProfilerTaskQueryMaxSize;
-
- private int resultWindowMaxSize = 10000;
- private int metadataQueryMaxSize = 5000;
- private int segmentQueryMaxSize = 200;
- private int profileDataQueryBatchSize = 100;
+ @Getter
+ @Setter
+ public static class RecordsSuper {
+ private int shardNum = 2;
+ private int segmentInterval = 1;
+ private int ttl = 3;
+ }
- // ----------------------------------------
- // The configuration of the groups.
- // since 10.2.0
- // ----------------------------------------
- // The group settings of record.
- // `gr` is the short name of the group settings of record.
- //
- // The "normal"(`gr...`) section defines settings for datasets not
specified in "super".
- // Each dataset will be grouped under a single group named "normal".
- // "super"(`grSuper...`) is a special dataset designed to store trace or
log data that is too large for normal datasets.
- // # Each super dataset will be a separate group in BanyanDB, following
the settings defined in the "super" section.
- // ----------------------------------------
// The group settings of metrics.
- // `gm` is the short name of the group settings of metrics.
//
// OAP stores metrics based its granularity.
// Valid values are "day", "hour", and "minute". That means metrics will
be stored in the three separate groups.
// Non-"minute" are governed by the "core.downsampling" setting.
// For example, if "core.downsampling" is set to "hour", the "hour" will
be used, while "day" are ignored.
- private int grNormalShardNum = 1;
- private int grNormalSIDays = 1;
- private int grNormalTTLDays = 3;
- private int grSuperShardNum = 2;
- private int grSuperSIDays = 1;
- private int grSuperTTLDays = 3;
- private int gmMinuteShardNum = 2;
- private int gmMinuteSIDays = 1;
- private int gmMinuteTTLDays = 7;
- private int gmHourShardNum = 1;
- private int gmHourSIDays = 1;
- private int gmHourTTLDays = 15;
- private int gmDayShardNum = 1;
- private int gmDaySIDays = 1;
- private int gmDayTTLDays = 30;
- private int gmIndexShardNum = 1;
- private int gmIndexSIDays = 1;
- private int gmIndexTTLDays = 30;
+ /**
+ * The MetricsMin defines settings for "minute" group metrics.
+ */
+ @Getter
+ @Setter
+ public static class MetricsMin {
+ private int shardNum = 2;
+ private int segmentInterval = 1;
+ private int ttl = 7;
+ }
- public String[] getTargetArray() {
- return
Iterables.toArray(Splitter.on(",").omitEmptyStrings().trimResults().split(this.targets),
String.class);
+ /**
+ * The MetricsHour defines settings for "hour" group metrics.
+ */
+ @Getter
+ @Setter
+ public static class MetricsHour {
+ private int shardNum = 1;
+ private int segmentInterval = 5;
+ private int ttl = 15;
+ }
+
+ /**
+ * The MetricsDay defines settings for "day" group metrics.
+ */
+ @Getter
+ @Setter
+ public static class MetricsDay {
+ private int shardNum = 1;
+ private int segmentInterval = 15;
+ private int ttl = 15;
+ }
+
+ /**
+ # If the metrics is marked as "index_mode", the metrics will be stored in
the "index" group.
+ # The "index" group is designed to store metrics that are used for
indexing without value columns.
+ # Such as `service_traffic`, `network_address_alias`, etc.
+ # "index_mode" requires BanyanDB *0.8.0* or later.
+ */
+ @Getter
+ @Setter
+ public static class Metadata {
+ private int shardNum = 2;
+ private int segmentInterval = 15;
+ private int ttl = 15;
}
}
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageProvider.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageProvider.java
index fb80d067e7..5b6392e581 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageProvider.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBStorageProvider.java
@@ -115,21 +115,23 @@ public class BanyanDBStorageProvider extends
ModuleProvider {
@Override
public void onInitialized(final BanyanDBStorageConfig initialized)
{
- config = initialized;
}
};
}
@Override
public void prepare() throws ServiceNotProvidedException,
ModuleStartException {
- if (config.getGmDayTTLDays() > config.getGmIndexTTLDays()) {
- throw new ModuleStartException("gmDayTTLDays must be less than or
equal to gmIndexTTLDays");
+ // load banyandb config
+ config = new BanyanDBConfigLoader(this).loadConfig();
+
+ if (config.getMetricsDay().getTtl() > config.getMetadata().getTtl()) {
+ throw new ModuleStartException("metricsDay ttl must be less than
or equal to metadata ttl");
}
- if (config.getGmHourTTLDays() > config.getGmIndexTTLDays()) {
- throw new ModuleStartException("gmHourTTLDays must be less than or
equal to gmIndexTTLDays");
+ if (config.getMetricsHour().getTtl() > config.getMetadata().getTtl()) {
+ throw new ModuleStartException("metricsHour must be less than or
equal to metadata ttl");
}
- if (config.getGmMinuteTTLDays() > config.getGmIndexTTLDays()) {
- throw new ModuleStartException("gmMinuteTTLDays must be less than
or equal to gmIndexTTLDays");
+ if (config.getMetricsMin().getTtl() > config.getMetadata().getTtl()) {
+ throw new ModuleStartException("metricsMin must be less than or
equal to metadata ttl");
}
this.registerServiceImplementation(StorageBuilderFactory.class, new
StorageBuilderFactory.Default());
@@ -138,34 +140,34 @@ public class BanyanDBStorageProvider extends
ModuleProvider {
// Stream
this.registerServiceImplementation(
- IBatchDAO.class, new BanyanDBBatchDAO(client,
config.getMaxBulkSize(), config.getFlushInterval(),
-
config.getConcurrentWriteThreads()
+ IBatchDAO.class, new BanyanDBBatchDAO(client,
config.getGlobal().getMaxBulkSize(), config.getGlobal().getFlushInterval(),
+
config.getGlobal().getConcurrentWriteThreads()
));
this.registerServiceImplementation(StorageDAO.class, new
BanyanDBStorageDAO(client));
this.registerServiceImplementation(INetworkAddressAliasDAO.class, new
BanyanDBNetworkAddressAliasDAO(client, this.config));
- this.registerServiceImplementation(ITraceQueryDAO.class, new
BanyanDBTraceQueryDAO(client, this.config.getSegmentQueryMaxSize()));
+ this.registerServiceImplementation(ITraceQueryDAO.class, new
BanyanDBTraceQueryDAO(client,
this.config.getGlobal().getSegmentQueryMaxSize()));
this.registerServiceImplementation(IBrowserLogQueryDAO.class, new
BanyanDBBrowserLogQueryDAO(client));
this.registerServiceImplementation(IMetadataQueryDAO.class, new
BanyanDBMetadataQueryDAO(client, this.config));
this.registerServiceImplementation(IAlarmQueryDAO.class, new
BanyanDBAlarmQueryDAO(client));
this.registerServiceImplementation(ILogQueryDAO.class, new
BanyanDBLogQueryDAO(client));
this.registerServiceImplementation(
IProfileTaskQueryDAO.class, new BanyanDBProfileTaskQueryDAO(client,
-
this.config.getProfileTaskQueryMaxSize()
+
this.config.getGlobal().getProfileTaskQueryMaxSize()
));
this.registerServiceImplementation(
IProfileTaskLogQueryDAO.class, new
BanyanDBProfileTaskLogQueryDAO(client,
-
this.config.getProfileTaskQueryMaxSize()
+
this.config.getGlobal().getProfileTaskQueryMaxSize()
));
this.registerServiceImplementation(
IProfileThreadSnapshotQueryDAO.class, new
BanyanDBProfileThreadSnapshotQueryDAO(client,
-
this.config.getProfileTaskQueryMaxSize()
+
this.config.getGlobal().getProfileTaskQueryMaxSize()
));
this.registerServiceImplementation(UITemplateManagementDAO.class, new
BanyanDBUITemplateManagementDAO(client));
this.registerServiceImplementation(UIMenuManagementDAO.class, new
BanyanDBUIMenuManagementDAO(client));
this.registerServiceImplementation(IEventQueryDAO.class, new
BanyanDBEventQueryDAO(client));
this.registerServiceImplementation(ITopologyQueryDAO.class, new
BanyanDBTopologyQueryDAO(client));
this.registerServiceImplementation(IEBPFProfilingTaskDAO.class, new
BanyanDBEBPFProfilingTaskDAO(client));
- this.registerServiceImplementation(IEBPFProfilingDataDAO.class, new
BanyanDBEBPFProfilingDataDAO(client,
this.config.getProfileDataQueryBatchSize()));
+ this.registerServiceImplementation(IEBPFProfilingDataDAO.class, new
BanyanDBEBPFProfilingDataDAO(client,
this.config.getGlobal().getProfileDataQueryBatchSize()));
this.registerServiceImplementation(
IEBPFProfilingScheduleDAO.class, new
BanyanDBEBPFProfilingScheduleQueryDAO(client));
this.registerServiceImplementation(IContinuousProfilingPolicyDAO.class, new
BanyanDBContinuousProfilingPolicyDAO(client));
@@ -177,15 +179,15 @@ public class BanyanDBStorageProvider extends
ModuleProvider {
this.registerServiceImplementation(IAggregationQueryDAO.class, new
BanyanDBAggregationQueryDAO(client));
this.registerServiceImplementation(IRecordsQueryDAO.class, new
BanyanDBRecordsQueryDAO(client));
this.registerServiceImplementation(IZipkinQueryDAO.class, new
BanyanDBZipkinQueryDAO(client));
- this.registerServiceImplementation(ISpanAttachedEventQueryDAO.class,
new BanyanDBSpanAttachedEventQueryDAO(client,
this.config.getProfileDataQueryBatchSize()));
+ this.registerServiceImplementation(ISpanAttachedEventQueryDAO.class,
new BanyanDBSpanAttachedEventQueryDAO(client,
this.config.getGlobal().getProfileDataQueryBatchSize()));
this.registerServiceImplementation(IHierarchyQueryDAO.class, new
BanyanDBHierarchyQueryDAO(client, this.config));
this.registerServiceImplementation(
IAsyncProfilerTaskQueryDAO.class, new
BanyanDBAsyncProfilerTaskQueryDAO(client,
- this.config.getAsyncProfilerTaskQueryMaxSize()
+
this.config.getGlobal().getAsyncProfilerTaskQueryMaxSize()
));
this.registerServiceImplementation(
IAsyncProfilerTaskLogQueryDAO.class, new
BanyanDBAsyncProfilerTaskLogQueryDAO(client,
- this.config.getAsyncProfilerTaskQueryMaxSize()
+
this.config.getGlobal().getAsyncProfilerTaskQueryMaxSize()
));
this.registerServiceImplementation(IJFRDataQueryDAO.class, new
BanyanDBJFRDataQueryDAO(client));
this.registerServiceImplementation(
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBTTLStatusQuery.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBTTLStatusQuery.java
index 9ad975c5f3..c60cd22c5b 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBTTLStatusQuery.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBTTLStatusQuery.java
@@ -18,6 +18,8 @@
package org.apache.skywalking.oap.server.storage.plugin.banyandb;
+import org.apache.skywalking.oap.server.core.storage.ttl.MetricsTTL;
+import org.apache.skywalking.oap.server.core.storage.ttl.RecordsTTL;
import org.apache.skywalking.oap.server.core.storage.ttl.StorageTTLStatusQuery;
import org.apache.skywalking.oap.server.core.storage.ttl.TTLDefinition;
@@ -29,15 +31,18 @@ public class BanyanDBTTLStatusQuery implements
StorageTTLStatusQuery {
private final int gmDayTTLDays;
public BanyanDBTTLStatusQuery(BanyanDBStorageConfig config) {
- grNormalTTLDays = config.getGrNormalTTLDays();
- grSuperTTLDays = config.getGrSuperTTLDays();
- gmMinuteTTLDays = config.getGmMinuteTTLDays();
- gmHourTTLDays = config.getGmHourTTLDays();
- gmDayTTLDays = config.getGmDayTTLDays();
+ grNormalTTLDays = config.getRecordsNormal().getTtl();
+ grSuperTTLDays = config.getRecordsSuper().getTtl();
+ gmMinuteTTLDays = config.getMetricsMin().getTtl();
+ gmHourTTLDays = config.getMetricsHour().getTtl();
+ gmDayTTLDays = config.getMetricsDay().getTtl();
}
@Override
public TTLDefinition getTTL() {
- return null;
+ return new TTLDefinition(
+ new MetricsTTL(gmMinuteTTLDays, gmHourTTLDays, gmDayTTLDays),
+ new RecordsTTL(grNormalTTLDays, grSuperTTLDays)
+ );
}
}
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/MetadataRegistry.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/MetadataRegistry.java
index 67ff29b655..f88c7619ea 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/MetadataRegistry.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/MetadataRegistry.java
@@ -466,17 +466,17 @@ public enum MetadataRegistry {
model.getName(),
Kind.STREAM,
model.getDownsampling(),
- model.isSuperDataset() ? config.getGrSuperShardNum() :
config.getGrNormalShardNum(),
- model.isSuperDataset() ? config.getGrSuperSIDays() :
config.getGrNormalSIDays(),
- model.isSuperDataset() ? config.getGrSuperTTLDays() :
config.getGrNormalTTLDays());
+ model.isSuperDataset() ?
config.getRecordsSuper().getShardNum() :
config.getRecordsNormal().getShardNum(),
+ model.isSuperDataset() ?
config.getRecordsSuper().getSegmentInterval() :
config.getRecordsNormal().getSegmentInterval(),
+ model.isSuperDataset() ? config.getRecordsSuper().getTtl()
: config.getRecordsNormal().getTtl());
}
if (model.getBanyanDBModelExtension().isIndexMode()) {
return new SchemaMetadata("index", model.getName(), Kind.MEASURE,
model.getDownsampling(),
- config.getGmIndexShardNum(),
- config.getGmIndexSIDays(),
- config.getGmIndexTTLDays());
+ config.getMetadata().getShardNum(),
+ config.getMetadata().getSegmentInterval(),
+ config.getMetadata().getTtl());
}
switch (model.getDownsampling()) {
@@ -485,9 +485,9 @@ public enum MetadataRegistry {
model.getName(),
Kind.MEASURE,
model.getDownsampling(),
- config.getGmMinuteShardNum(),
- config.getGmMinuteSIDays(),
- config.getGmMinuteTTLDays());
+ config.getMetricsMin().getShardNum(),
+ config.getMetricsMin().getSegmentInterval(),
+ config.getMetricsMin().getTtl());
case Hour:
if (!configService.shouldToHour()) {
throw new UnsupportedOperationException("downsampling to
hour is not supported");
@@ -496,9 +496,9 @@ public enum MetadataRegistry {
model.getName(),
Kind.MEASURE,
model.getDownsampling(),
- config.getGmHourShardNum(),
- config.getGmHourSIDays(),
- config.getGmHourTTLDays());
+ config.getMetricsHour().getShardNum(),
+ config.getMetricsHour().getSegmentInterval(),
+ config.getMetricsHour().getTtl());
case Day:
if (!configService.shouldToDay()) {
throw new UnsupportedOperationException("downsampling to
day is not supported");
@@ -507,9 +507,9 @@ public enum MetadataRegistry {
model.getName(),
Kind.MEASURE,
model.getDownsampling(),
- config.getGmDayShardNum(),
- config.getGmDaySIDays(),
- config.getGmDayTTLDays());
+ config.getMetricsDay().getShardNum(),
+ config.getMetricsDay().getSegmentInterval(),
+ config.getMetricsDay().getTtl());
default:
throw new UnsupportedOperationException("unsupported
downSampling interval:" + model.getDownsampling());
}
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBHierarchyQueryDAO.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBHierarchyQueryDAO.java
index a733fbedd1..a7e2361dc0 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBHierarchyQueryDAO.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBHierarchyQueryDAO.java
@@ -57,7 +57,7 @@ public class BanyanDBHierarchyQueryDAO extends
AbstractBanyanDBDAO implements IH
public BanyanDBHierarchyQueryDAO(final BanyanDBStorageClient client,
BanyanDBStorageConfig config) {
super(client);
- this.limit = config.getMetadataQueryMaxSize();
+ this.limit = config.getGlobal().getMetadataQueryMaxSize();
}
@Override
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBMetadataQueryDAO.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBMetadataQueryDAO.java
index 74d8dfd210..9bc0f548e2 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBMetadataQueryDAO.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBMetadataQueryDAO.java
@@ -86,7 +86,7 @@ public class BanyanDBMetadataQueryDAO extends
AbstractBanyanDBDAO implements IMe
public BanyanDBMetadataQueryDAO(BanyanDBStorageClient client,
BanyanDBStorageConfig config) {
super(client);
- this.limit = config.getMetadataQueryMaxSize();
+ this.limit = config.getGlobal().getMetadataQueryMaxSize();
}
@Override
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBNetworkAddressAliasDAO.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBNetworkAddressAliasDAO.java
index 44f38d7106..71d6d12aad 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBNetworkAddressAliasDAO.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBNetworkAddressAliasDAO.java
@@ -51,7 +51,7 @@ public class BanyanDBNetworkAddressAliasDAO extends
AbstractBanyanDBDAO implemen
public BanyanDBNetworkAddressAliasDAO(final BanyanDBStorageClient client,
BanyanDBStorageConfig config) {
super(client);
- this.limit = config.getResultWindowMaxSize();
+ this.limit = config.getGlobal().getResultWindowMaxSize();
}
private MetadataRegistry.Schema getSchema() {
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBServiceLabelDAO.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBServiceLabelDAO.java
index 630c041546..d5e578d29e 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBServiceLabelDAO.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/measure/BanyanDBServiceLabelDAO.java
@@ -41,7 +41,7 @@ public class BanyanDBServiceLabelDAO extends
AbstractBanyanDBDAO implements ISer
public BanyanDBServiceLabelDAO(final BanyanDBStorageClient client,
BanyanDBStorageConfig config) {
super(client);
- this.limit = config.getMetadataQueryMaxSize();
+ this.limit = config.getGlobal().getMetadataQueryMaxSize();
}
@Override
diff --git
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBIT.java
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBIT.java
index 038f06d245..fe78339cbe 100644
---
a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBIT.java
+++
b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBIT.java
@@ -100,7 +100,7 @@ public class BanyanDBIT {
protected void setUpConnection() throws Exception {
log.info("create BanyanDB client and try to connect");
config = new BanyanDBStorageConfig();
- config.setTargets(banyanDB.getHost() + ":" +
banyanDB.getMappedPort(GRPC_PORT));
+ config.getGlobal().setTargets(banyanDB.getHost() + ":" +
banyanDB.getMappedPort(GRPC_PORT));
client = new BanyanDBStorageClient(config);
client.connect();
}
@@ -134,10 +134,10 @@ public class BanyanDBIT {
//test Group install
BanyandbCommon.Group group =
client.client.findGroup(DownSampling.Minute.getName());
assertEquals(BanyandbCommon.Catalog.CATALOG_MEASURE,
group.getCatalog());
- assertEquals(config.getGmMinuteSIDays(),
group.getResourceOpts().getSegmentInterval().getNum());
- assertEquals(config.getGmMinuteShardNum(),
group.getResourceOpts().getShardNum());
+ assertEquals(config.getMetricsMin().getSegmentInterval(),
group.getResourceOpts().getSegmentInterval().getNum());
+ assertEquals(config.getMetricsMin().getShardNum(),
group.getResourceOpts().getShardNum());
assertEquals(BanyandbCommon.IntervalRule.Unit.UNIT_DAY,
group.getResourceOpts().getSegmentInterval().getUnit());
- assertEquals(config.getGmMinuteTTLDays(),
group.getResourceOpts().getTtl().getNum());
+ assertEquals(config.getMetricsMin().getTtl(),
group.getResourceOpts().getTtl().getNum());
assertEquals(BanyandbCommon.IntervalRule.Unit.UNIT_DAY,
group.getResourceOpts().getTtl().getUnit());
installer.createTable(model);
@@ -202,9 +202,9 @@ public class BanyanDBIT {
Model updatedModel = models.add(UpdateTestMetric.class,
DefaultScopeDefine.SERVICE,
new Storage("testMetric", true,
DownSampling.Minute)
);
- config.setGmMinuteShardNum(config.getGmDayShardNum() + 1);
- config.setGmMinuteSIDays(config.getGmDaySIDays() + 2);
- config.setGmMinuteTTLDays(config.getGmDayTTLDays() + 3);
+
config.getMetricsMin().setShardNum(config.getMetricsDay().getShardNum() + 1);
+
config.getMetricsMin().setSegmentInterval(config.getMetricsDay().getSegmentInterval()
+ 2);
+ config.getMetricsMin().setTtl(config.getMetricsDay().getTtl() + 3);
BanyanDBIndexInstaller newInstaller = new
BanyanDBIndexInstaller(client, moduleManager, config);
newInstaller.isExists(updatedModel);
//test Group update