From 59d923ebc1b80a0173ed894ecac6880fdbdb02f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=80=85=E5=BC=88?= Date: Fri, 1 Mar 2019 13:39:50 +0800 Subject: [PATCH] Add an ApiCommandHandler to list all available commands and description (#491) * Add a ApiCommandHandler which fetch all registered CommandHandlers so that user can get all available CommandHandlers by request /api * Add a customized CommandHandler demo --- .../FetchClusterClientConfigHandler.java | 2 +- .../ModifyClusterClientConfigHandler.java | 2 +- .../FetchClusterFlowRulesCommandHandler.java | 2 +- .../FetchClusterMetricCommandHandler.java | 2 +- ...chClusterParamFlowRulesCommandHandler.java | 2 +- .../FetchClusterServerConfigHandler.java | 2 +- .../FetchClusterServerInfoCommandHandler.java | 2 +- .../ModifyClusterFlowRulesCommandHandler.java | 2 +- ...fyClusterParamFlowRulesCommandHandler.java | 2 +- .../ModifyClusterServerFlowConfigHandler.java | 2 +- ...fyClusterServerTransportConfigHandler.java | 2 +- .../ModifyServerNamespaceSetHandler.java | 2 +- sentinel-demo/pom.xml | 1 + .../sentinel-demo-command-handler/pom.xml | 35 +++++++++++ .../demo/commandhandler/Application.java | 31 ++++++++++ .../commandhandler/EchoCommandHandler.java | 46 ++++++++++++++ .../demo/commandhandler/MainController.java | 48 +++++++++++++++ ...libaba.csp.sentinel.command.CommandHandler | 1 + .../handler/FetchTopParamsCommandHandler.java | 2 +- .../GetParamFlowRulesCommandHandler.java | 2 +- .../ModifyParamFlowRulesCommandHandler.java | 2 +- .../command/annotation/CommandMapping.java | 9 ++- .../command/handler/ApiCommandHandler.java | 60 +++++++++++++++++++ .../handler/BasicInfoCommandHandler.java | 2 +- .../FetchActiveRuleCommandHandler.java | 2 +- .../FetchClusterNodeByIdCommandHandler.java | 2 +- .../FetchClusterNodeHumanCommandHandler.java | 2 +- .../handler/FetchJsonTreeCommandHandler.java | 2 +- .../handler/FetchOriginCommandHandler.java | 2 +- .../FetchSimpleClusterNodeCommandHandler.java | 2 +- .../FetchSystemStatusCommandHandler.java | 2 +- .../handler/FetchTreeCommandHandler.java | 2 +- .../handler/ModifyRulesCommandHandler.java | 2 +- .../handler/OnOffGetCommandHandler.java | 2 +- .../handler/OnOffSetCommandHandler.java | 2 +- .../handler/SendMetricCommandHandler.java | 2 +- .../handler/VersionCommandHandler.java | 2 +- .../FetchClusterModeCommandHandler.java | 2 +- .../ModifyClusterModeCommandHandler.java | 2 +- ...libaba.csp.sentinel.command.CommandHandler | 3 +- 40 files changed, 259 insertions(+), 37 deletions(-) create mode 100644 sentinel-demo/sentinel-demo-command-handler/pom.xml create mode 100644 sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/Application.java create mode 100644 sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/EchoCommandHandler.java create mode 100644 sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/MainController.java create mode 100755 sentinel-demo/sentinel-demo-command-handler/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler create mode 100644 sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ApiCommandHandler.java diff --git a/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterClientConfigHandler.java b/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterClientConfigHandler.java index dc9d5299..9ce5c322 100644 --- a/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterClientConfigHandler.java +++ b/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterClientConfigHandler.java @@ -29,7 +29,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/client/fetchConfig") +@CommandMapping(name = "cluster/client/fetchConfig", desc = "get cluster client config") public class FetchClusterClientConfigHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyClusterClientConfigHandler.java b/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyClusterClientConfigHandler.java index b1c528e0..189e7942 100644 --- a/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyClusterClientConfigHandler.java +++ b/sentinel-cluster/sentinel-cluster-client-default/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyClusterClientConfigHandler.java @@ -33,7 +33,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/client/modifyConfig") +@CommandMapping(name = "cluster/client/modifyConfig", desc = "modify cluster client config") public class ModifyClusterClientConfigHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterFlowRulesCommandHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterFlowRulesCommandHandler.java index 359dfc18..a9a1766d 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterFlowRulesCommandHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterFlowRulesCommandHandler.java @@ -27,7 +27,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/flowRules") +@CommandMapping(name = "cluster/server/flowRules", desc = "get cluster flow rules") public class FetchClusterFlowRulesCommandHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterMetricCommandHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterMetricCommandHandler.java index 4d9f7997..72c8aeea 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterMetricCommandHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterMetricCommandHandler.java @@ -27,7 +27,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 1.4.1 */ -@CommandMapping(name = "cluster/server/metricList") +@CommandMapping(name = "cluster/server/metricList", desc = "get cluster server metrics") public class FetchClusterMetricCommandHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterParamFlowRulesCommandHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterParamFlowRulesCommandHandler.java index 5f490411..19865a15 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterParamFlowRulesCommandHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterParamFlowRulesCommandHandler.java @@ -27,7 +27,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/paramRules") +@CommandMapping(name = "cluster/server/paramRules", desc = "get cluster server param flow rules") public class FetchClusterParamFlowRulesCommandHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerConfigHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerConfigHandler.java index 72b94640..121fe0ec 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerConfigHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerConfigHandler.java @@ -29,7 +29,7 @@ import com.alibaba.fastjson.JSONObject; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/fetchConfig") +@CommandMapping(name = "cluster/server/fetchConfig", desc = "get cluster server config") public class FetchClusterServerConfigHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerInfoCommandHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerInfoCommandHandler.java index d2ed63af..d8ce97e5 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerInfoCommandHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/FetchClusterServerInfoCommandHandler.java @@ -35,7 +35,7 @@ import com.alibaba.fastjson.JSONObject; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/info") +@CommandMapping(name = "cluster/server/info", desc = "get cluster server info") public class FetchClusterServerInfoCommandHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterFlowRulesCommandHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterFlowRulesCommandHandler.java index 08882c09..66833cb5 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterFlowRulesCommandHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterFlowRulesCommandHandler.java @@ -32,7 +32,7 @@ import com.alibaba.fastjson.JSONArray; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/modifyFlowRules") +@CommandMapping(name = "cluster/server/modifyFlowRules", desc = "modify cluster flow rules") public class ModifyClusterFlowRulesCommandHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterParamFlowRulesCommandHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterParamFlowRulesCommandHandler.java index b4632173..393950f7 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterParamFlowRulesCommandHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterParamFlowRulesCommandHandler.java @@ -32,7 +32,7 @@ import com.alibaba.fastjson.JSONArray; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/modifyParamRules") +@CommandMapping(name = "cluster/server/modifyParamRules", desc = "modify cluster param flow rules") public class ModifyClusterParamFlowRulesCommandHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerFlowConfigHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerFlowConfigHandler.java index 38ed2572..22885105 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerFlowConfigHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerFlowConfigHandler.java @@ -32,7 +32,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/modifyFlowConfig") +@CommandMapping(name = "cluster/server/modifyFlowConfig", desc = "modify cluster server flow config") public class ModifyClusterServerFlowConfigHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerTransportConfigHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerTransportConfigHandler.java index f1e267db..174e7271 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerTransportConfigHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyClusterServerTransportConfigHandler.java @@ -27,7 +27,7 @@ import com.alibaba.csp.sentinel.util.StringUtil; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/modifyTransportConfig") +@CommandMapping(name = "cluster/server/modifyTransportConfig", desc = "modify cluster server transport config") public class ModifyClusterServerTransportConfigHandler implements CommandHandler { @Override diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyServerNamespaceSetHandler.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyServerNamespaceSetHandler.java index 4a78600f..2891623c 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyServerNamespaceSetHandler.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/command/handler/ModifyServerNamespaceSetHandler.java @@ -33,7 +33,7 @@ import com.alibaba.fastjson.TypeReference; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "cluster/server/modifyNamespaceSet") +@CommandMapping(name = "cluster/server/modifyNamespaceSet", desc = "modify server namespace set") public class ModifyServerNamespaceSetHandler implements CommandHandler { @Override diff --git a/sentinel-demo/pom.xml b/sentinel-demo/pom.xml index e519e045..ffcd42f4 100755 --- a/sentinel-demo/pom.xml +++ b/sentinel-demo/pom.xml @@ -29,6 +29,7 @@ sentinel-demo-parameter-flow-control sentinel-demo-slot-chain-spi sentinel-demo-cluster + sentinel-demo-command-handler diff --git a/sentinel-demo/sentinel-demo-command-handler/pom.xml b/sentinel-demo/sentinel-demo-command-handler/pom.xml new file mode 100644 index 00000000..bb0cf7af --- /dev/null +++ b/sentinel-demo/sentinel-demo-command-handler/pom.xml @@ -0,0 +1,35 @@ + + + + sentinel-demo + com.alibaba.csp + 1.4.2-SNAPSHOT + + 4.0.0 + + sentinel-demo-command-handler + + + + com.alibaba.csp + sentinel-cluster-client-default + 1.4.2-SNAPSHOT + + + com.alibaba.csp + sentinel-cluster-server-default + 1.4.2-SNAPSHOT + + + com.alibaba.csp + sentinel-transport-simple-http + + + org.springframework.boot + spring-boot-starter-web + 1.5.17.RELEASE + + + \ No newline at end of file diff --git a/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/Application.java b/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/Application.java new file mode 100644 index 00000000..614c9157 --- /dev/null +++ b/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/Application.java @@ -0,0 +1,31 @@ +/* + * Copyright 1999-2019 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.csp.sentinel.demo.commandhandler; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author houyi + **/ +@SpringBootApplication(scanBasePackages = {"com.alibaba.csp.sentinel"}) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/EchoCommandHandler.java b/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/EchoCommandHandler.java new file mode 100644 index 00000000..717f5623 --- /dev/null +++ b/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/EchoCommandHandler.java @@ -0,0 +1,46 @@ +/* + * Copyright 1999-2019 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.csp.sentinel.demo.commandhandler; + +import com.alibaba.csp.sentinel.command.CommandHandler; +import com.alibaba.csp.sentinel.command.CommandRequest; +import com.alibaba.csp.sentinel.command.CommandResponse; +import com.alibaba.csp.sentinel.command.annotation.CommandMapping; + +/** + * Customized CommandHandler + * This Class is a demo shows how to create a customized CommandHandler + *
    + *
  • 1.Create a class which implements the {@link CommandHandler} interface
  • + *
  • 2.Use a {@link CommandMapping} to specify the url and desc of your CommandHandler
  • + *
  • 3.Implement your own handle method
  • + *
  • 4.Add your CommandHandler in com.alibaba.csp.sentinel.command.CommandHandler file which is stored in resources/META-INF/services/
  • + *
+ * @author houyi + **/ +@CommandMapping(name = "echo", desc = "echo service") +public class EchoCommandHandler implements CommandHandler { + + @Override + public CommandResponse handle(CommandRequest request) { + String name = request.getParam("name"); + if(name==null || name.trim().length()==0){ + return CommandResponse.ofSuccess("Tell us what's your name by submit a name parameter"); + } + return CommandResponse.ofSuccess("Hello: "+name); + } + +} diff --git a/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/MainController.java b/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/MainController.java new file mode 100644 index 00000000..3dfa7e1c --- /dev/null +++ b/sentinel-demo/sentinel-demo-command-handler/src/main/java/com/alibaba/csp/sentinel/demo/commandhandler/MainController.java @@ -0,0 +1,48 @@ +/* + * Copyright 1999-2019 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.csp.sentinel.demo.commandhandler; + +import com.alibaba.csp.sentinel.SphU; +import com.alibaba.csp.sentinel.slots.block.BlockException; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +/** + * @author houyi + **/ +@Controller +public class MainController { + + /** + * init sentinel + * @return pass or block + */ + @GetMapping("/init") + public @ResponseBody + String init() { + String retVal; + String resource = "init"; + try{ + SphU.entry(resource); + retVal = "pass"; + }catch (BlockException e){ + retVal = "block"; + } + return retVal; + } + +} diff --git a/sentinel-demo/sentinel-demo-command-handler/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler b/sentinel-demo/sentinel-demo-command-handler/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler new file mode 100755 index 00000000..e1d5b5d1 --- /dev/null +++ b/sentinel-demo/sentinel-demo-command-handler/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler @@ -0,0 +1 @@ +com.alibaba.csp.sentinel.demo.commandhandler.EchoCommandHandler \ No newline at end of file diff --git a/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTopParamsCommandHandler.java b/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTopParamsCommandHandler.java index ddebeaf6..bcd7ce53 100644 --- a/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTopParamsCommandHandler.java +++ b/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTopParamsCommandHandler.java @@ -30,7 +30,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 0.2.0 */ -@CommandMapping(name = "topParams") +@CommandMapping(name = "topParams", desc = "get topN param in specified resource, accept param: res={resourceName}&idx={paramIndex}&n={topN}") public class FetchTopParamsCommandHandler implements CommandHandler { @Override diff --git a/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/GetParamFlowRulesCommandHandler.java b/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/GetParamFlowRulesCommandHandler.java index dd1bb721..9d3c918c 100644 --- a/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/GetParamFlowRulesCommandHandler.java +++ b/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/GetParamFlowRulesCommandHandler.java @@ -26,7 +26,7 @@ import com.alibaba.fastjson.JSON; * @author Eric Zhao * @since 0.2.0 */ -@CommandMapping(name = "getParamFlowRules") +@CommandMapping(name = "getParamFlowRules", desc = "get param flow rules") public class GetParamFlowRulesCommandHandler implements CommandHandler { @Override diff --git a/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyParamFlowRulesCommandHandler.java b/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyParamFlowRulesCommandHandler.java index ffd9073a..e859db38 100644 --- a/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyParamFlowRulesCommandHandler.java +++ b/sentinel-extension/sentinel-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyParamFlowRulesCommandHandler.java @@ -33,7 +33,7 @@ import com.alibaba.fastjson.JSONArray; * @author Eric Zhao * @since 0.2.0 */ -@CommandMapping(name = "setParamFlowRules") +@CommandMapping(name = "setParamFlowRules", desc = "set param flow rules, accept param: data={paramFlowRule Json}") public class ModifyParamFlowRulesCommandHandler implements CommandHandler { private static WritableDataSource> paramFlowWds = null; diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/annotation/CommandMapping.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/annotation/CommandMapping.java index ad7f353c..b698da6b 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/annotation/CommandMapping.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/annotation/CommandMapping.java @@ -15,11 +15,7 @@ */ package com.alibaba.csp.sentinel.command.annotation; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import java.lang.annotation.*; /** * @author Eric Zhao @@ -30,4 +26,7 @@ import java.lang.annotation.Target; public @interface CommandMapping { String name(); + + String desc(); + } diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ApiCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ApiCommandHandler.java new file mode 100644 index 00000000..b8db7594 --- /dev/null +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ApiCommandHandler.java @@ -0,0 +1,60 @@ +/* + * Copyright 1999-2019 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.csp.sentinel.command.handler; + +import com.alibaba.csp.sentinel.command.CommandHandler; +import com.alibaba.csp.sentinel.command.CommandHandlerProvider; +import com.alibaba.csp.sentinel.command.CommandRequest; +import com.alibaba.csp.sentinel.command.CommandResponse; +import com.alibaba.csp.sentinel.command.annotation.CommandMapping; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.util.Map; + +/** + *

+ * List all available command handlers by request:
+ * {@code curl http://localhost:8719/api} + *

+ * @author houyi + **/ +@CommandMapping(name = "api", desc = "get all available command handlers") +public class ApiCommandHandler implements CommandHandler { + + @Override + public CommandResponse handle(CommandRequest request) { + Map handlers = CommandHandlerProvider.getInstance().namedHandlers(); + JSONArray array = new JSONArray(); + if (handlers.isEmpty()) { + return CommandResponse.ofSuccess(array.toJSONString()); + } + for (CommandHandler handler : handlers.values()) { + CommandMapping commandMapping = handler.getClass().getAnnotation(CommandMapping.class); + if (commandMapping == null) { + continue; + } + String api = commandMapping.name(); + String desc = commandMapping.desc(); + JSONObject obj = new JSONObject(); + obj.put("url", "/" + api); + obj.put("desc", desc); + array.add(obj); + } + return CommandResponse.ofSuccess(array.toJSONString()); + } + +} diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/BasicInfoCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/BasicInfoCommandHandler.java index fbd5f892..5e50fd86 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/BasicInfoCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/BasicInfoCommandHandler.java @@ -26,7 +26,7 @@ import com.alibaba.csp.sentinel.util.HostNameUtil; * * @author Eric Zhao */ -@CommandMapping(name = "basicInfo") +@CommandMapping(name = "basicInfo", desc = "get sentinel config info") public class BasicInfoCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchActiveRuleCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchActiveRuleCommandHandler.java index 3e427d46..16f2ffe9 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchActiveRuleCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchActiveRuleCommandHandler.java @@ -28,7 +28,7 @@ import com.alibaba.fastjson.JSON; /** * @author jialiang.linjl */ -@CommandMapping(name = "getRules") +@CommandMapping(name = "getRules", desc = "get all active rules by type, request param: type={ruleType}") public class FetchActiveRuleCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeByIdCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeByIdCommandHandler.java index 9b9a9cc1..969b0c51 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeByIdCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeByIdCommandHandler.java @@ -28,7 +28,7 @@ import com.alibaba.fastjson.JSON; /** * @author qinan.qn */ -@CommandMapping(name = "clusterNodeById") +@CommandMapping(name = "clusterNodeById", desc = "get clusterNode VO by id, request param: id={resourceName}") public class FetchClusterNodeByIdCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeHumanCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeHumanCommandHandler.java index eb1444fd..80105b61 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeHumanCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchClusterNodeHumanCommandHandler.java @@ -29,7 +29,7 @@ import com.alibaba.csp.sentinel.slots.clusterbuilder.ClusterBuilderSlot; /** * @author qinan.qn */ -@CommandMapping(name = "cnode") +@CommandMapping(name = "cnode", desc = "get clusterNode metrics by id, request param: id={resourceName}") public class FetchClusterNodeHumanCommandHandler implements CommandHandler { private final static String FORMAT = "%-4s%-80s%-10s%-10s%-10s%-11s%-9s%-6s%-10s%-11s%-9s%-11s"; diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchJsonTreeCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchJsonTreeCommandHandler.java index e8f82397..ed057216 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchJsonTreeCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchJsonTreeCommandHandler.java @@ -32,7 +32,7 @@ import com.alibaba.fastjson.JSON; /** * @author leyou */ -@CommandMapping(name = "jsonTree") +@CommandMapping(name = "jsonTree", desc = "get tree node VO start from root node") public class FetchJsonTreeCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchOriginCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchOriginCommandHandler.java index 4005c39a..b8ef8878 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchOriginCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchOriginCommandHandler.java @@ -29,7 +29,7 @@ import com.alibaba.csp.sentinel.slots.clusterbuilder.ClusterBuilderSlot; /** * @author qinan.qn */ -@CommandMapping(name = "origin") +@CommandMapping(name = "origin", desc = "get origin clusterNode by id, request param: id={resourceName}") public class FetchOriginCommandHandler implements CommandHandler { private final static String FORMAT = "%-4s%-80s%-10s%-10s%-11s%-9s%-6s%-10s%-11s%-9s"; diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSimpleClusterNodeCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSimpleClusterNodeCommandHandler.java index 375fadde..30ac8851 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSimpleClusterNodeCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSimpleClusterNodeCommandHandler.java @@ -32,7 +32,7 @@ import com.alibaba.fastjson.JSONArray; /** * @author jialiang.linjl */ -@CommandMapping(name = "clusterNode") +@CommandMapping(name = "clusterNode", desc = "get all clusterNode VO, use type=notZero to ignore those nodes with totalRequest <=0") public class FetchSimpleClusterNodeCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSystemStatusCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSystemStatusCommandHandler.java index 4ffebb9b..b4d99c93 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSystemStatusCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchSystemStatusCommandHandler.java @@ -28,7 +28,7 @@ import com.alibaba.fastjson.JSONObject; /** * @author jialiang.linjl */ -@CommandMapping(name = "systemStatus") +@CommandMapping(name = "systemStatus", desc = "get system status") public class FetchSystemStatusCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTreeCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTreeCommandHandler.java index bdb81bb6..91a53dc0 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTreeCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/FetchTreeCommandHandler.java @@ -27,7 +27,7 @@ import com.alibaba.csp.sentinel.node.Node; /** * @author qinan.qn */ -@CommandMapping(name = "tree") +@CommandMapping(name = "tree", desc = "get metrics in tree mode, use id to specify detailed tree root") public class FetchTreeCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyRulesCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyRulesCommandHandler.java index 126a16dc..e17ed447 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyRulesCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/ModifyRulesCommandHandler.java @@ -41,7 +41,7 @@ import static com.alibaba.csp.sentinel.transport.util.WritableDataSourceRegistry * @author jialiang.linjl * @author Eric Zhao */ -@CommandMapping(name = "setRules") +@CommandMapping(name = "setRules", desc = "modify the rules, accept param: type={ruleType}&data={ruleJson}") public class ModifyRulesCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffGetCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffGetCommandHandler.java index 476b4efe..032642d4 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffGetCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffGetCommandHandler.java @@ -24,7 +24,7 @@ import com.alibaba.csp.sentinel.command.annotation.CommandMapping; /** * @author youji.zj */ -@CommandMapping(name = "getSwitch") +@CommandMapping(name = "getSwitch", desc = "get sentinel switch status") public class OnOffGetCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffSetCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffSetCommandHandler.java index 7854a4db..05820afd 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffSetCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/OnOffSetCommandHandler.java @@ -25,7 +25,7 @@ import com.alibaba.csp.sentinel.Constants; /** * @author youji.zj */ -@CommandMapping(name = "setSwitch") +@CommandMapping(name = "setSwitch", desc = "set sentinel switch, accept param: value={true|false}") public class OnOffSetCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/SendMetricCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/SendMetricCommandHandler.java index 1fe605d4..e841004c 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/SendMetricCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/SendMetricCommandHandler.java @@ -34,7 +34,7 @@ import com.alibaba.csp.sentinel.node.metric.MetricWriter; * @author leyou * @author Eric Zhao */ -@CommandMapping(name = "metric") +@CommandMapping(name = "metric", desc = "get and aggregate metrics, accept param: startTime={startTime}&endTime={endTime}&maxLines={maxLines}&identify={resourceName}") public class SendMetricCommandHandler implements CommandHandler { private MetricSearcher searcher; diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/VersionCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/VersionCommandHandler.java index 3895626f..e8bad295 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/VersionCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/VersionCommandHandler.java @@ -25,7 +25,7 @@ import com.alibaba.csp.sentinel.command.annotation.CommandMapping; * @author jialiang.linjl * @author Eric Zhao */ -@CommandMapping(name = "version") +@CommandMapping(name = "version", desc = "get sentinel version") public class VersionCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/FetchClusterModeCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/FetchClusterModeCommandHandler.java index 14be5199..10df72a4 100644 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/FetchClusterModeCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/FetchClusterModeCommandHandler.java @@ -28,7 +28,7 @@ import com.alibaba.fastjson.JSONObject; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "getClusterMode") +@CommandMapping(name = "getClusterMode", desc = "get cluster mode status") public class FetchClusterModeCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/ModifyClusterModeCommandHandler.java b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/ModifyClusterModeCommandHandler.java index 9841c02f..bad05134 100644 --- a/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/ModifyClusterModeCommandHandler.java +++ b/sentinel-transport/sentinel-transport-common/src/main/java/com/alibaba/csp/sentinel/command/handler/cluster/ModifyClusterModeCommandHandler.java @@ -28,7 +28,7 @@ import com.alibaba.csp.sentinel.log.RecordLog; * @author Eric Zhao * @since 1.4.0 */ -@CommandMapping(name = "setClusterMode") +@CommandMapping(name = "setClusterMode", desc = "set cluster mode, accept param: mode={0|1} 0:client mode 1:server mode") public class ModifyClusterModeCommandHandler implements CommandHandler { @Override diff --git a/sentinel-transport/sentinel-transport-common/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler b/sentinel-transport/sentinel-transport-common/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler index 2edadbd4..67380d3c 100755 --- a/sentinel-transport/sentinel-transport-common/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler +++ b/sentinel-transport/sentinel-transport-common/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler @@ -13,4 +13,5 @@ com.alibaba.csp.sentinel.command.handler.OnOffSetCommandHandler com.alibaba.csp.sentinel.command.handler.SendMetricCommandHandler com.alibaba.csp.sentinel.command.handler.VersionCommandHandler com.alibaba.csp.sentinel.command.handler.cluster.FetchClusterModeCommandHandler -com.alibaba.csp.sentinel.command.handler.cluster.ModifyClusterModeCommandHandler \ No newline at end of file +com.alibaba.csp.sentinel.command.handler.cluster.ModifyClusterModeCommandHandler +com.alibaba.csp.sentinel.command.handler.ApiCommandHandler \ No newline at end of file