ot_app_analyst.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package router
  2. import (
  3. "go-admin/app/observe/apis"
  4. "go-admin/common/actions"
  5. "go-admin/common/middleware"
  6. "github.com/gin-gonic/gin"
  7. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  8. )
  9. func init() {
  10. // routerNoCheckRole = append(routerNoCheckRole, registerAppAnalystRouterTest)
  11. routerCheckRole = append(routerCheckRole, registerAppAnalystRouter)
  12. }
  13. // 需认证的路由代码
  14. func registerAppAnalystRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  15. api := apis.AppScore{}
  16. r := v1.Group("/app/analyst").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction())
  17. {
  18. r.GET("/:app_alias", api.CalAppLatency)
  19. r.GET("/:app_alias/svr", api.CalServiceLatency)
  20. r.GET("/:app_alias/edge", api.CalEdgeLatency)
  21. }
  22. }
  23. // 无需认证的路由代码
  24. // func registerAppAnalystRouterTest(v1 *gin.RouterGroup) {
  25. // api := apis.AppScore{}
  26. // r := v1.Group("/test/app/analyst")
  27. // {
  28. // r.GET("/:app_alias", api.CalAppLatency)
  29. // r.GET("/:app_alias/svr", api.CalServiceLatency)
  30. // r.GET("/:app_alias/edge", api.CalEdgeLatency)
  31. // }
  32. // }