You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2026/10/14 23:48:10 UTC

(skywalking) branch master updated: Fix a UI template update on BanyanDB leaving a disabled template disabled (#14133)

This is an automated email from the ASF dual-hosted git repository.

wu-sheng 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 2a25e04581 Fix a UI template update on BanyanDB leaving a disabled template disabled (#14133)
2a25e04581 is described below

commit 2a25e0458132aa6ba6add203d7b87b2f82540e30
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Oct 15 07:48:05 2026 +0800

    Fix a UI template update on BanyanDB leaving a disabled template disabled (#14133)
    
    DashboardSetting.toEntity() sets disabled to false, and the ElasticSearch and
    JDBC DAOs write the whole record on an update, so an update enables the
    template. The BanyanDB DAO applied a patch of only the configuration and the
    update time, so a disabled template stayed disabled. On ElasticSearch and JDBC
    an update is the only way to bring a disabled template back, since adding
    refuses an existing id.
    
    changeTemplate now writes every tag, as addTemplate does; the partial
    applyConfiguration is no longer used and is removed. The ui-management e2e
    case updates the template after disabling it, and checks that it is enabled
    and listed again.
---
 docs/en/changes/changes.md                         |  1 +
 .../banyandb/BanyanDBUITemplateManagementDAO.java  | 22 +++-----------------
 .../ui-management/expected/template-list-one.yml   | 15 ++++++++++++++
 .../ui-management/expected/template-reenabled.yml  | 16 +++++++++++++++
 .../cases/ui-management/ui-management-cases.yaml   | 24 +++++++++++++++++++++-
 5 files changed, 58 insertions(+), 20 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 337a939904..5d2bd52961 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -42,6 +42,7 @@
 * Fix the OTLP/HTTP JSON trace endpoint reading the hex `traceId`, `spanId` and `parentSpanId` the OTLP/JSON encoding specifies as base64, the protobuf JSON mapping. The bodies parsed without an error into ids of the wrong length, so a trace exported as JSON matched neither the ids its SDK logged nor the same trace exported over gRPC or OTLP/HTTP protobuf.
 * Fix the heatmap query failing on a meter histogram whose bucket bounds exceed an int, such as the `9223372036854775807` key MAL gives an OTel histogram's `+Inf` bucket: the bucket keys are read as longs.
 * Cut the slow statements a LAL `SlowSQL` output writes, as the default `mysql-slowsql`, `pgsql-slowsql` and `redis-slowsql` rules do, to the 2000 characters of the `top_n_database_statement` column, as the agent path already cuts them to `maxSlowSQLLength`. A longer statement was refused by a strict SQL store, and stored whole on Elasticsearch and BanyanDB; it is now cut there too.
+* Fix a UI template update on BanyanDB leaving a disabled template disabled. `PUT /ui-management/templates` wrote only the configuration there, while on ElasticSearch and JDBC it replaces the whole record and enables it. An update is the only way to bring a disabled template back on those two stores, where adding refuses an existing id; the BanyanDB update now writes the whole record too, so the same call works on every storage.
 
 #### UI
 * Add a Virtual GenAI evaluation-record page and evaluation-score chart in Horizon UI, so operators can inspect evaluation result, level, reason, judge model, timestamp, trace linkage, and the `gen_ai_model_evaluation_score_ppm` trend for evaluated records.
diff --git a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBUITemplateManagementDAO.java b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBUITemplateManagementDAO.java
index 278b819077..e7d4956c74 100644
--- a/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBUITemplateManagementDAO.java
+++ b/oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBUITemplateManagementDAO.java
@@ -77,7 +77,9 @@ public class BanyanDBUITemplateManagementDAO extends AbstractBanyanDBDAO impleme
 
     @Override
     public TemplateChangeStatus changeTemplate(DashboardSetting setting) {
-        Property newTemplate = applyConfiguration(setting.toEntity());
+        // Write every tag, as ElasticSearch and JDBC replace the whole record: an update
+        // re-enables a disabled template, the only way the API has to do so.
+        Property newTemplate = applyAll(setting.toEntity());
         try {
             this.getClient().apply(newTemplate);
             return TemplateChangeStatus.builder()
@@ -166,22 +168,4 @@ public class BanyanDBUITemplateManagementDAO extends AbstractBanyanDBDAO impleme
                 .addTags(TagAndValue.newLongTag(UITemplate.UPDATE_TIME, uiTemplate.getUpdateTime()).build())
             .build();
     }
-
-    /**
-     * Partial apply configuration, i.e. configuration tag.
-     *
-     * @param uiTemplate previous UITemplate
-     * @return new property (patch) to be applied
-     */
-    public Property applyConfiguration(UITemplate uiTemplate) {
-        MetadataRegistry.Schema schema = MetadataRegistry.INSTANCE.findManagementMetadata(UITemplate.INDEX_NAME);
-        return Property.newBuilder()
-                .setMetadata(BanyandbCommon.Metadata.newBuilder()
-                    .setGroup(schema.getMetadata().getGroup())
-                    .setName(UITemplate.INDEX_NAME))
-                .setId(uiTemplate.id().build())
-                .addTags(TagAndValue.newStringTag(UITemplate.CONFIGURATION, uiTemplate.getConfiguration()).build())
-                .addTags(TagAndValue.newLongTag(UITemplate.UPDATE_TIME, uiTemplate.getUpdateTime()).build())
-            .build();
-    }
 }
diff --git a/test/e2e-v2/cases/ui-management/expected/template-list-one.yml b/test/e2e-v2/cases/ui-management/expected/template-list-one.yml
new file mode 100644
index 0000000000..75d689659b
--- /dev/null
+++ b/test/e2e-v2/cases/ui-management/expected/template-list-one.yml
@@ -0,0 +1,15 @@
+# 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.
+1
diff --git a/test/e2e-v2/cases/ui-management/expected/template-reenabled.yml b/test/e2e-v2/cases/ui-management/expected/template-reenabled.yml
new file mode 100644
index 0000000000..6baeb73955
--- /dev/null
+++ b/test/e2e-v2/cases/ui-management/expected/template-reenabled.yml
@@ -0,0 +1,16 @@
+# 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.
+configuration: '{"name":"e2e-tpl","v":3}'
+disabled: false
diff --git a/test/e2e-v2/cases/ui-management/ui-management-cases.yaml b/test/e2e-v2/cases/ui-management/ui-management-cases.yaml
index bc572ce17f..3dd15aa0f2 100644
--- a/test/e2e-v2/cases/ui-management/ui-management-cases.yaml
+++ b/test/e2e-v2/cases/ui-management/ui-management-cases.yaml
@@ -16,7 +16,7 @@
 # Dashboard-template CRUD over the admin-server `ui-management` module, driven by
 # `swctl admin ui-template ...` instead of raw curl. The cases walk
 # create -> get -> update -> get -> disable -> list-default vs. list-with-disabled
-# to exercise the full cycle. The client supplies a fixed template id on create so
+# -> update again, which re-enables it, to exercise the full cycle. The client supplies a fixed template id on create so
 # the later steps address it without reading it back.
 
 cases:
@@ -70,3 +70,25 @@ cases:
         admin ui-template list --include-disabled \
         | yq -P '.[] | select(.id == "e2e-tpl-id") | {"disabled": .disabled}'
     expected: expected/template-list-disabled.yml
+
+  # 8. Update the disabled template. An update always leaves the template
+  #    enabled, on every storage: it is how a disabled template comes back.
+  - query: |
+      printf '%s' '{"name":"e2e-tpl","v":3}' > /tmp/uitpl-cfg3.json
+      swctl --display json --admin-url=http://${oap_host}:${oap_17128} \
+        admin ui-template update --id e2e-tpl-id -f /tmp/uitpl-cfg3.json \
+        | yq -P '{"status": .status, "id": .id}'
+    expected: expected/template-changed.yml
+
+  # 9. Get — the new configuration, and enabled again.
+  - query: |
+      swctl --display json --admin-url=http://${oap_host}:${oap_17128} \
+        admin ui-template get e2e-tpl-id \
+        | yq -P '{"configuration": .configuration, "disabled": .disabled}'
+    expected: expected/template-reenabled.yml
+
+  # 10. The default list returns it again.
+  - query: |
+      swctl --display json --admin-url=http://${oap_host}:${oap_17128} \
+        admin ui-template list | yq -P '. | length'
+    expected: expected/template-list-one.yml