-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager.go
80 lines (55 loc) · 1.67 KB
/
manager.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package controller
import (
"context"
"net/http"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/route"
"github.com/yylt/lokihub/pkg/loki"
)
type Manager struct {
mux *loki.Mux
}
func New(mux *loki.Mux, routes *route.RouterGroup) *Manager {
m := &Manager{
mux: mux,
}
m.probe(routes)
return m
}
func (m *Manager) probe(routes *route.RouterGroup) {
routes.GET("/loki/api/v1/index/stats", m.IndexStatsHandler)
routes.GET("/loki/api/v1/label/:name/values", m.LabelValueHandler)
routes.GET("/loki/api/v1/labels", m.LabelsHandler)
routes.GET("/loki/api/v1/query_range", m.LogQueryRangeHandler)
// ... TODO
}
// loki/api/v1/query
func (m *Manager) LogQueryHandler(c context.Context, ctx *app.RequestContext) {
}
// loki/api/v1/query_range
func (m *Manager) LogQueryRangeHandler(c context.Context, ctx *app.RequestContext) {
}
// loki/api/v1/labels
func (m *Manager) LabelsHandler(c context.Context, ctx *app.RequestContext) {
}
// loki/api/v1/label/<name>/values
func (m *Manager) LabelValueHandler(c context.Context, ctx *app.RequestContext) {
}
// loki/api/v1/series
func (m *Manager) SeriesHandler(c context.Context, ctx *app.RequestContext) {
}
// loki/api/v1/tail
func (m *Manager) TailHandler(c context.Context, ctx *app.RequestContext) {
}
// loki/api/v1/metrics
func (m *Manager) MetricsHandler(c context.Context, ctx *app.RequestContext) {
}
// loki/api/v1/push
func (m *Manager) PushHandler(w http.ResponseWriter, r *http.Request) {
}
// loki/api/v1/ready
func (m *Manager) ReadyHandler(w http.ResponseWriter, r *http.Request) {
}
// loki/api/v1/index/stats
func (m *Manager) IndexStatsHandler(c context.Context, ctx *app.RequestContext) {
}