service.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package router
  2. import (
  3. "go-admin/app/observe/apis"
  4. "go-admin/common/middleware"
  5. "github.com/gin-gonic/gin"
  6. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerServiceGraphRouter2)
  10. routerNoCheckRole = append(routerNoCheckRole, registerServiceGraphRouter)
  11. }
  12. // 接口从observe-ui发出请求,不能加权限验证
  13. // func registerServiceGraphRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  14. // api := apis.ServiceGraph{}
  15. // r := v1.Group("/service").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction())
  16. // {
  17. // r.GET("/graph", api.Show)
  18. // r.GET("/side", api.SpanScatterChart)
  19. // }
  20. // }
  21. func registerServiceGraphRouter(v1 *gin.RouterGroup) {
  22. api := apis.Service{}
  23. r := v1.Group("/service")
  24. {
  25. r.GET("/digits/gen", api.DigitsGen)
  26. }
  27. }
  28. func registerServiceGraphRouter2(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  29. // func registerServiceGraphRouter2(v1 *gin.RouterGroup) {
  30. api := apis.Service{}
  31. r := v1.Group("/service").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  32. // r := v1.Group("/service")
  33. {
  34. // r.POST("/show", api.Show)
  35. // r.POST("/side", api.SpanScatterChart)
  36. r.GET("", api.List)
  37. r.GET("/noapp", api.ListNoAppAlias)
  38. r.PUT("/:id", api.Update)
  39. r.GET("/stats", api.Stats)
  40. r.GET("/digits", api.Digits)
  41. r.GET("/graph", api.Show)
  42. r.GET("/side", api.SpanScatterChart)
  43. r.GET("/liveness", api.ServiceLiveness)
  44. r.GET("/spans", api.Spans)
  45. r.GET("/graph/gen", api.GenGraph)
  46. r.GET("/compare/liveness", api.CompareServiceLiveness)
  47. r.GET("/compare/errors", api.CompareServiceErrors)
  48. }
  49. }