This is an automated email from the ASF dual-hosted git repository. hanahmily pushed a commit to branch banyandb-property in repository https://gitbox.apache.org/repos/asf/skywalking.git
commit 986364928fca2acd948197052a55c8e61a627078 Author: Gao Hongtao <[email protected]> AuthorDate: Sat Jan 4 07:52:21 2025 +0800 Support BanyanDB's new property Signed-off-by: Gao Hongtao <[email protected]> --- oap-server-bom/pom.xml | 2 +- .../plugin/banyandb/BanyanDBStorageClient.java | 33 +++++++------- .../plugin/banyandb/BanyanDBStorageProvider.java | 51 ++++++++++++---------- test/e2e-v2/script/env | 2 +- 4 files changed, 46 insertions(+), 42 deletions(-) diff --git a/oap-server-bom/pom.xml b/oap-server-bom/pom.xml index 32481c60a7..92ffd3f9c3 100644 --- a/oap-server-bom/pom.xml +++ b/oap-server-bom/pom.xml @@ -72,7 +72,7 @@ <httpcore.version>4.4.13</httpcore.version> <httpasyncclient.version>4.1.5</httpasyncclient.version> <commons-compress.version>1.21</commons-compress.version> - <banyandb-java-client.version>0.8.0-rc0</banyandb-java-client.version> + <banyandb-java-client.version>0.8.0-rc1</banyandb-java-client.version> <kafka-clients.version>3.4.0</kafka-clients.version> <spring-kafka-test.version>2.4.6.RELEASE</spring-kafka-test.version> <consul.client.version>1.5.3</consul.client.version> 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 30e4c63b9e..a00ab5af24 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 @@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.storage.plugin.banyandb; import io.grpc.Status; import org.apache.skywalking.banyandb.database.v1.BanyandbDatabase; +import org.apache.skywalking.banyandb.property.v1.BanyandbProperty; import org.apache.skywalking.banyandb.v1.client.BanyanDBClient; import org.apache.skywalking.banyandb.v1.client.MeasureBulkWriteProcessor; import org.apache.skywalking.banyandb.v1.client.MeasureQuery; @@ -78,9 +79,12 @@ public class BanyanDBStorageClient implements Client, HealthCheckable { public List<Property> listProperties(String group, String name) throws IOException { try { - List<Property> properties = this.client.findProperties(group, name); + BanyandbProperty.QueryResponse resp = this.client.query(BanyandbProperty.QueryRequest.newBuilder() + .addGroups(group) + .setContainer(name) + .build()); this.healthChecker.health(); - return properties; + return resp.getPropertiesList(); } catch (BanyanDBException ex) { if (ex.getStatus().equals(Status.Code.NOT_FOUND)) { this.healthChecker.health(); @@ -94,9 +98,16 @@ public class BanyanDBStorageClient implements Client, HealthCheckable { public Property queryProperty(String group, String name, String id) throws IOException { try { - Property p = this.client.findProperty(group, name, id); + BanyandbProperty.QueryResponse resp = this.client.query(BanyandbProperty.QueryRequest.newBuilder() + .addGroups(group) + .setContainer(name) + .addIds(id) + .build()); this.healthChecker.health(); - return p; + if (resp.getPropertiesCount() == 0) { + return null; + } + return resp.getProperties(0); } catch (BanyanDBException ex) { if (ex.getStatus().equals(Status.Code.NOT_FOUND)) { this.healthChecker.health(); @@ -108,9 +119,9 @@ public class BanyanDBStorageClient implements Client, HealthCheckable { } } - public DeleteResponse deleteProperty(String group, String name, String id, String... tags) throws IOException { + public DeleteResponse deleteProperty(String group, String name, String id) throws IOException { try { - DeleteResponse result = this.client.deleteProperty(group, name, id, tags); + DeleteResponse result = this.client.deleteProperty(group, name, id); this.healthChecker.health(); return result; } catch (BanyanDBException ex) { @@ -119,16 +130,6 @@ public class BanyanDBStorageClient implements Client, HealthCheckable { } } - public void keepAliveProperty(long leaseId) throws IOException { - try { - this.client.keepAliveProperty(leaseId); - this.healthChecker.health(); - } catch (BanyanDBException ex) { - healthChecker.unHealth(ex); - throw new IOException("fail to keep alive property", ex); - } - } - public StreamQueryResponse query(StreamQuery q) throws IOException { try { StreamQueryResponse response = this.client.query(q); 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 0d777ba2da..2ff17b2fde 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 @@ -138,9 +138,9 @@ 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.getMaxBulkSize(), config.getFlushInterval(), + config.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())); @@ -149,17 +149,17 @@ public class BanyanDBStorageProvider extends ModuleProvider { this.registerServiceImplementation(IAlarmQueryDAO.class, new BanyanDBAlarmQueryDAO(client)); this.registerServiceImplementation(ILogQueryDAO.class, new BanyanDBLogQueryDAO(client)); this.registerServiceImplementation( - IProfileTaskQueryDAO.class, new BanyanDBProfileTaskQueryDAO(client, - this.config.getProfileTaskQueryMaxSize() - )); + IProfileTaskQueryDAO.class, new BanyanDBProfileTaskQueryDAO(client, + this.config.getProfileTaskQueryMaxSize() + )); this.registerServiceImplementation( - IProfileTaskLogQueryDAO.class, new BanyanDBProfileTaskLogQueryDAO(client, - this.config.getProfileTaskQueryMaxSize() - )); + IProfileTaskLogQueryDAO.class, new BanyanDBProfileTaskLogQueryDAO(client, + this.config.getProfileTaskQueryMaxSize() + )); this.registerServiceImplementation( - IProfileThreadSnapshotQueryDAO.class, new BanyanDBProfileThreadSnapshotQueryDAO(client, - this.config.getProfileTaskQueryMaxSize() - )); + IProfileThreadSnapshotQueryDAO.class, new BanyanDBProfileThreadSnapshotQueryDAO(client, + this.config.getProfileTaskQueryMaxSize() + )); this.registerServiceImplementation(UITemplateManagementDAO.class, new BanyanDBUITemplateManagementDAO(client)); this.registerServiceImplementation(UIMenuManagementDAO.class, new BanyanDBUIMenuManagementDAO(client)); this.registerServiceImplementation(IEventQueryDAO.class, new BanyanDBEventQueryDAO(client)); @@ -167,7 +167,7 @@ public class BanyanDBStorageProvider extends ModuleProvider { this.registerServiceImplementation(IEBPFProfilingTaskDAO.class, new BanyanDBEBPFProfilingTaskDAO(client)); this.registerServiceImplementation(IEBPFProfilingDataDAO.class, new BanyanDBEBPFProfilingDataDAO(client, this.config.getProfileDataQueryBatchSize())); this.registerServiceImplementation( - IEBPFProfilingScheduleDAO.class, new BanyanDBEBPFProfilingScheduleQueryDAO(client)); + IEBPFProfilingScheduleDAO.class, new BanyanDBEBPFProfilingScheduleQueryDAO(client)); this.registerServiceImplementation(IContinuousProfilingPolicyDAO.class, new BanyanDBContinuousProfilingPolicyDAO(client)); this.registerServiceImplementation(IServiceLabelDAO.class, new BanyanDBServiceLabelDAO(client, this.config)); @@ -189,28 +189,31 @@ public class BanyanDBStorageProvider extends ModuleProvider { )); this.registerServiceImplementation(IJFRDataQueryDAO.class, new BanyanDBJFRDataQueryDAO(client)); this.registerServiceImplementation( - StorageTTLStatusQuery.class, - new BanyanDBTTLStatusQuery(config) + StorageTTLStatusQuery.class, + new BanyanDBTTLStatusQuery(config) ); } @Override public void start() throws ServiceNotProvidedException, ModuleStartException { MetricsCreator metricCreator = getManager().find(TelemetryModule.NAME) - .provider() - .getService(MetricsCreator.class); + .provider() + .getService(MetricsCreator.class); HealthCheckMetrics healthChecker = metricCreator.createHealthCheckerGauge( - "storage_banyandb", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE); + "storage_banyandb", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE); this.client.registerChecker(healthChecker); try { this.client.connect(); this.client.defineIfEmpty(BanyandbCommon.Group.newBuilder() - .setMetadata( - BanyandbCommon.Metadata.newBuilder() - .setName( - BanyanDBUITemplateManagementDAO.GROUP)) - .setCatalog(BanyandbCommon.Catalog.CATALOG_UNSPECIFIED) - .build()); + .setMetadata( + BanyandbCommon.Metadata.newBuilder() + .setName( + BanyanDBUITemplateManagementDAO.GROUP)) + .setCatalog(BanyandbCommon.Catalog.CATALOG_PROPERTY) + .setResourceOpts(BanyandbCommon.ResourceOpts.newBuilder() + .setShardNum(1) + ) + .build()); this.modelInstaller.start(); getManager().find(CoreModule.NAME).provider().getService(ModelCreator.class).addModelListener(modelInstaller); diff --git a/test/e2e-v2/script/env b/test/e2e-v2/script/env index 5e6fc2cded..353e497660 100644 --- a/test/e2e-v2/script/env +++ b/test/e2e-v2/script/env @@ -23,7 +23,7 @@ SW_AGENT_CLIENT_JS_COMMIT=af0565a67d382b683c1dbd94c379b7080db61449 SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016 SW_KUBERNETES_COMMIT_SHA=1335f15bf821a40a7cd71448fa805f0be265afcc SW_ROVER_COMMIT=0ae8f12d6eb6cc9fa125c603ee57d0b21fc8c6d0 -SW_BANYANDB_COMMIT=7f291fc5c626ea8b0d33c947563f7984cfc4886e +SW_BANYANDB_COMMIT=8dfe616f332848f041b0f184b023d9a256eac39e SW_AGENT_PHP_COMMIT=3192c553002707d344bd6774cfab5bc61f67a1d3 SW_CTL_COMMIT=67cbc89dd7b214d5791321a7ca992f940cb586ba
