diff --git a/lms/nladmin-system/pom.xml b/lms/nladmin-system/pom.xml index ef69e16b4..f2935de4f 100644 --- a/lms/nladmin-system/pom.xml +++ b/lms/nladmin-system/pom.xml @@ -32,6 +32,28 @@ + + + + com.plumelog + plumelog-lite-spring-boot-starter + 3.5.3 + + + plumelog-core + com.plumelog + + + + + + com.plumelog + plumelog-trace + 3.5.2 + + + + org.reflections reflections diff --git a/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java b/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java index 28a447c96..78684351c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java +++ b/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java @@ -12,17 +12,20 @@ * 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.nl.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.server.standard.ServerEndpointExporter; +*/ /** * @author ZhangHouYing * @date 2019-08-24 15:44 - */ + *//* + @Configuration public class WebSocketConfig { @@ -31,3 +34,4 @@ public class WebSocketConfig { return new ServerEndpointExporter(); } } +*/ diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/loki/rest/LokiController.java b/lms/nladmin-system/src/main/java/org/nl/modules/loki/rest/LokiController.java deleted file mode 100644 index e498cb664..000000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/loki/rest/LokiController.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.nl.modules.loki.rest; - -import com.alibaba.fastjson.JSONObject; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.annotation.RateLimiter; -import org.nl.modules.loki.service.LokiService; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -/** - * @Author: lyd - * @Description: 日志监控 - * @Date: 2022-08-15 - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "日志监控") -@RequestMapping("/api/loki") -@Slf4j -public class LokiController { - - private final LokiService lokiService; - - @GetMapping("/labels/values") - @ApiOperation("获取标签") - public ResponseEntity labelsValues() { - return new ResponseEntity<>(lokiService.getLabelsValues(), HttpStatus.OK); - } - - @PostMapping("/logs") - @ApiOperation("获取日志") - @RateLimiter(value = 1, timeout = 300) // 限流 - public ResponseEntity getLogData(@RequestBody JSONObject json) { - return new ResponseEntity<>(lokiService.getLogData(json), HttpStatus.OK); - } -} diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/LokiService.java b/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/LokiService.java deleted file mode 100644 index 10101c914..000000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/LokiService.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.nl.modules.loki.service; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - -/** - * @Author: lyd - * @Description: 服务类 - * @Date: 2022-08-15 - */ -public interface LokiService { - - /** - * 获取日志信息 - * @param json - * @return - */ - JSONObject getLogData(JSONObject json); - - /** - * 获取labels和values树 - * @return - */ - JSONArray getLabelsValues(); -} diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/impl/LokiServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/impl/LokiServiceImpl.java deleted file mode 100644 index f6eeb49c0..000000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/impl/LokiServiceImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.nl.modules.loki.service.impl; - -import cn.hutool.core.util.CharsetUtil; -import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import org.nl.modules.loki.service.LokiService; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -/** - * @Author: lyd - * @Description: 实现类 - * @Date: 2022-08-15 - */ -@Service -@RequiredArgsConstructor -public class LokiServiceImpl implements LokiService { - - @Value("${loki.url}") - private String lokiUrl; - - @Value("${loki.systemName}") - private String systemName; - - @Override - public JSONObject getLogData(JSONObject json) { - String logLabel = ""; - String logLabelValue = ""; - Long start = 0L; - Long end = 0L; - String text = ""; - String limit = "100"; - String direction = "backward"; - if (json.get("logLabel") != null) logLabel = json.getString("logLabel"); - if (json.get("logLabelValue") != null) logLabelValue = json.getString("logLabelValue"); - if (json.get("text") != null) text = json.getString("text"); - if (json.get("start") != null) start = json.getLong("start"); - if (json.get("end") != null) end = json.getLong("end"); - if (json.get("limits") != null) limit = json.getString("limits"); - if (json.get("direction") != null) direction = json.getString("direction"); - /** - * 组织参数 - * 纳秒数 - * 1660037391880000000 - * 1641453208415000000 - * http://localhost:3100/loki/api/v1/query_range?query={host="localhost"} |= ``&limit=1500&start=1641453208415000000&end=1660027623419419002 - */ - JSONObject parse = null; - String query = lokiUrl + "/query_range?query={system=\"" + systemName + "\", " + logLabel + "=\"" + logLabelValue + "\"} |= `" + text + "`"; - String result = ""; - if (start==0L) { - result = HttpUtil.get(query + "&limit=" + limit + "&direction=" + direction, CharsetUtil.CHARSET_UTF_8); - } else { - result = HttpUtil.get(query + "&limit=" + limit + "&start=" + start + "&end=" + end + "&direction=" + direction, CharsetUtil.CHARSET_UTF_8); - } - try { - parse = (JSONObject) JSONObject.parse(result); - } catch (Exception e) { -// reslut的值可能为:too many outstanding requests,无法转化成Json - System.out.println("reslut:" + result); -// e.printStackTrace(); - } - return parse; - } - - /** - * 获取labels和values树 - * - * @return - */ - @Override - public JSONArray getLabelsValues() { - /** - * [{ - * label: - * value: - * children:[{ - * label - * value - * }] - * }] - */ - JSONArray result = new JSONArray(); - // 获取所有标签 - String labelString = HttpUtil.get(lokiUrl + "/labels", CharsetUtil.CHARSET_UTF_8); - JSONObject parse = (JSONObject) JSONObject.parse(labelString); - JSONArray labels = parse.getJSONArray("data"); - for (int i=0; i - - - 1000 - - ${LOKI_URL}/push - - - - - ${log.pattern} - - true - + + lms + + /plumelog/lite + + 15 + sleuth @@ -85,7 +77,7 @@ https://juejin.cn/post/6844903775631572999 - + @@ -131,55 +123,55 @@ https://juejin.cn/post/6844903775631572999 - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/lms/nladmin-ui/src/views/wms/sch/point/index.vue b/lms/nladmin-ui/src/views/wms/sch/point/index.vue index 6f986c5b2..3b2b05fd6 100644 --- a/lms/nladmin-ui/src/views/wms/sch/point/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/point/index.vue @@ -188,7 +188,7 @@ > 解锁 - 仓位同步 - + -->