From 6a61862b6f39c926ba4ab507738345284b276de0 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Thu, 4 Jan 2024 23:58:43 +0800 Subject: [PATCH] Add druid StatFilter controller --- .../controller/MetricsController.java | 31 +++++++++++++++++++ src/main/resources/application-dev.yml | 4 +-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/apache/eventmesh/dashboard/controller/MetricsController.java diff --git a/src/main/java/org/apache/eventmesh/dashboard/controller/MetricsController.java b/src/main/java/org/apache/eventmesh/dashboard/controller/MetricsController.java new file mode 100644 index 00000000..dfe3a463 --- /dev/null +++ b/src/main/java/org/apache/eventmesh/dashboard/controller/MetricsController.java @@ -0,0 +1,31 @@ +/* + * 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.eventmesh.dashboard.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alibaba.druid.stat.DruidStatManagerFacade; + +@RestController +public class MetricsController { + @GetMapping("/druid/stat") + public Object druidStat() { + return DruidStatManagerFacade.getInstance().getDataSourceStatDataList(); + } +} \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 87d20de2..91377864 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -19,7 +19,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource druid: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/eventmesh-dashboard?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://localhost:3306/eventmesh-dashboard?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 username: root password: @@ -39,7 +39,7 @@ spring: filter: wall: config: - multi-statement-allow: true # corresponding to allowMultiQueries=true + multi-statement-allow: true # corresponds to allowMultiQueries eventmesh: meta: