typescript Grafana总是在NestJS后端请求/API/live/ws

7eumitmz  于 2023-06-24  发布在  TypeScript
关注(0)|答案(1)|浏览(158)

我用我的NestJS后端设置了Grafana和Grafana Loki,它工作得很好。我可以在格拉法纳弄到我的日志。但是我也意识到我的NestJS抛出了一个404错误,因为Grafana请求了/api/live/ws路由。

    • 是否可以在Grafana中禁用此功能?**
    • 为什么Grafana要这样做?**
NestJS Error

exception NotFoundException: Cannot GET /api/live/ws
    at callback (/Users/hraschan/private/gymble-nestjs-backend/node_modules/@nestjs/core/router/routes-resolver.js:77:19)
    at /Users/hraschan/private/gymble-nestjs-backend/node_modules/@nestjs/core/router/router-proxy.js:9:23
    at Layer.handle [as handle_request] (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:328:13)
    at /Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/index.js:280:10)
    at LoggerMiddleware.use (/Users/hraschan/private/gymble-nestjs-backend/src/core/middleware/logger.middleware.ts:29:5)
    at /Users/hraschan/private/gymble-nestjs-backend/node_modules/@nestjs/core/router/router-proxy.js:9:23
    at Layer.handle [as handle_request] (/Users/hraschan/private/gymble-nestjs-backend/node_modules/express/lib/router/layer.js:95:5) {
  response: {
    statusCode: 404,
    message: 'Cannot GET /api/live/ws',
    error: 'Not Found'
  },
  status: 404,
  options: {}
}

我发现有一个叫Grafana Live的功能,我试图在grafana.ini配置中停用它。可惜这并没有奏效。
仅供参考:我使用nest-winston登录NestJS,使用winston-loki包将日志推送到Grafana Loki。

3pmvbmvn

3pmvbmvn1#

应该选择这里提到的格式:nestjs global inject nestwinston and format
你可以用NestJS提供端点:D
在同一个图书馆看到了你的问题。
但决定这样做:https://www.youtube.com/watch?v=2ESOGJTXv1s

相关问题