From a7a6e3db709bd6acdef89333f2585f599709afe3 Mon Sep 17 00:00:00 2001 From: Wu Sheng Date: Fri, 7 Aug 2026 17:04:07 -0700 Subject: [PATCH] Document the `meter-analyzer-config` catalog in admin runtime-rule / dsl-debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apache/skywalking#13969 brings native meter (MeterReportService) rules to parity with otel-rules: they now load through the shared Rules pipeline, so a meter rule can be hot-added, overridden or inactivated at runtime and attached to a MAL DSL debug session. On the wire that is purely additive — one more value in the shared `Catalog` enum (`METER_ANALYZER_CONFIG`). No new endpoints, no new request or response fields. swctl therefore needs no functional change: `--catalog` is passed through verbatim, and pkg/admin/runtimerule only ever calls the canonical `/runtime/rule/...` routes, never the per-catalog shortcut routes that `meter-analyzer-config` deliberately lacks. The OAP-side e2e added in that commit already drives the whole flow (bundled / add / edit / dsl-debug / inactivate) through `swctl admin ...` against this catalog. What was stale was discoverability, so: - add `meter-analyzer-config` to the `--catalog` flag help of `admin runtime-rule` and `admin dsl-debug session start`, and to the `admin runtime-rule` catalog list. - drop the two unreferenced `Catalogs` vars in pkg/admin/{runtimerule,dsldebug}. Nothing read them — they were a second copy of the catalog list, free to drift out of sync with OAP's enum, and this change is exactly the drift they would have caused. The rendered help text is now the single place the list lives; widening it is not a client-side allow-list, so a newer OAP catalog keeps working without a CLI release. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGES.md | 1 + internal/commands/admin/dsldebug/dsldebug.go | 2 +- internal/commands/admin/runtimerule/runtimerule.go | 4 ++-- pkg/admin/dsldebug/dsldebug.go | 3 --- pkg/admin/runtimerule/runtimerule.go | 3 --- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a401f8a..3e7a3a8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ Release Notes. * Add the sub-command `profiling pprof` for pprof query API by @JophieQu in https://github.com/apache/skywalking-cli/pull/226 * Add the `admin` command group for the OAP admin-server REST host (default port `17128`), with a new global `--admin-url` flag (derived from `--base-url` when unset). Covers every admin feature module: `admin preflight`; `admin cluster nodes`, `admin config dump|ttl`, `admin alarm rules|rule` (status); `admin inspect metrics|entities` (inspect); `admin ui-template list|get|create|update|disable` (ui-management); `admin runtime-rule list|bundled|get|add|inactivate|delete|dump` (runtime-rule); and `admin dsl-debug status|sessions|session start|get|stop` plus `admin oal files|file|rules|rule` (dsl-debugging). * Add the sub-command `admin inspect values` to read the VALUES of metric(s) an OAP does not define locally (foreign metrics) by supplying their `{valueColumn, valueType}` metadata, via the new `POST /inspect/values` admin API; returns the native MQE result. +* Document the `meter-analyzer-config` catalog in `admin runtime-rule` and `admin dsl-debug session start`, matching the OAP-side support for native meter rule hot-update and MAL DSL debugging. ### Bug Fixes diff --git a/internal/commands/admin/dsldebug/dsldebug.go b/internal/commands/admin/dsldebug/dsldebug.go index 2d04953..e8e0a98 100644 --- a/internal/commands/admin/dsldebug/dsldebug.go +++ b/internal/commands/admin/dsldebug/dsldebug.go @@ -86,7 +86,7 @@ $ swctl admin dsl-debug session start --catalog otel-rules --name vm --rule-name Flags: []cli.Flag{ &cli.StringFlag{ Name: "catalog", - Usage: "session `catalog`: otel-rules / log-mal-rules / telegraf-rules / lal / oal", + Usage: "session `catalog`: otel-rules / log-mal-rules / telegraf-rules / meter-analyzer-config / lal / oal", Required: true, }, &cli.StringFlag{ diff --git a/internal/commands/admin/runtimerule/runtimerule.go b/internal/commands/admin/runtimerule/runtimerule.go index fc93803..f56aa8a 100644 --- a/internal/commands/admin/runtimerule/runtimerule.go +++ b/internal/commands/admin/runtimerule/runtimerule.go @@ -36,7 +36,7 @@ var Command = &cli.Command{ UsageText: `Add, override, inactivate and delete MAL / LAL rule files at runtime without restarting OAP, and inspect the live and bundled rule state. -Catalogs: otel-rules, log-mal-rules, telegraf-rules, lal.`, +Catalogs: otel-rules, log-mal-rules, telegraf-rules, meter-analyzer-config, lal.`, Subcommands: []*cli.Command{ listCommand, bundledCommand, @@ -51,7 +51,7 @@ Catalogs: otel-rules, log-mal-rules, telegraf-rules, lal.`, func catalogFlag(required bool) cli.Flag { return &cli.StringFlag{ Name: "catalog", - Usage: "rule `catalog`: otel-rules / log-mal-rules / telegraf-rules / lal", + Usage: "rule `catalog`: otel-rules / log-mal-rules / telegraf-rules / meter-analyzer-config / lal", Required: required, } } diff --git a/pkg/admin/dsldebug/dsldebug.go b/pkg/admin/dsldebug/dsldebug.go index a87fb52..ebd2708 100644 --- a/pkg/admin/dsldebug/dsldebug.go +++ b/pkg/admin/dsldebug/dsldebug.go @@ -36,9 +36,6 @@ const ( MaxRetentionMillis = 60 * 60 * 1000 ) -// Catalogs accepted by a debug session. -var Catalogs = []string{"otel-rules", "log-mal-rules", "telegraf-rules", "lal", "oal"} - // StartArgs holds the inputs of POST /dsl-debugging/session. Catalog, Name, RuleName // and ClientID are mandatory query params; RecordCap / RetentionMillis are optional and // sent as a JSON body only when set. Granularity (LAL only) is sent as a query param. diff --git a/pkg/admin/runtimerule/runtimerule.go b/pkg/admin/runtimerule/runtimerule.go index c98b236..9b9fc55 100644 --- a/pkg/admin/runtimerule/runtimerule.go +++ b/pkg/admin/runtimerule/runtimerule.go @@ -31,9 +31,6 @@ import ( "github.com/apache/skywalking-cli/pkg/admin/client" ) -// Catalogs accepted by the runtime-rule endpoints. -var Catalogs = []string{"otel-rules", "log-mal-rules", "telegraf-rules", "lal"} - // ApplyResult is the JSON envelope returned by addOrUpdate / inactivate / delete. type ApplyResult struct { ApplyStatus string `json:"applyStatus"`