forked from open-falcon/falcon-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph_routes.go
34 lines (27 loc) · 1.02 KB
/
graph_routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package graph
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/open-falcon/falcon-plus/modules/api/app/utils"
"github.com/open-falcon/falcon-plus/modules/api/config"
)
var db config.DBPool
const badstatus = http.StatusBadRequest
const expecstatus = http.StatusExpectationFailed
func Routes(r *gin.Engine) {
db = config.Con()
authapi := r.Group("/api/v1")
authapi.Use(utils.AuthSessionMidd)
authapi.GET("/graph/endpointobj", EndpointObjGet)
authapi.GET("/graph/endpoint", EndpointRegexpQuery)
authapi.GET("/graph/endpoint_counter", EndpointCounterRegexpQuery)
authapi.POST("/graph/history", QueryGraphDrawData)
authapi.POST("/graph/lastpoint", QueryGraphLastPoint)
authapi.DELETE("/graph/endpoint", DeleteGraphEndpoint)
authapi.DELETE("/graph/counter", DeleteGraphCounter)
grfanaapi := r.Group("/api")
grfanaapi.GET("/v1/grafana", GrafanaMainQuery)
grfanaapi.GET("/v1/grafana/metrics/find", GrafanaMainQuery)
grfanaapi.POST("/v1/grafana/render", GrafanaRender)
grfanaapi.GET("/v1/grafana/render", GrafanaRender)
}