update
This commit is contained in:
1 parent
0ed2935f04
commit
c8cc0fb28a
11 files changed
+602
-21
No files matched your search
@@ -22,6 +22,7 @@ import (
|
||||
"git.tornberg.me/go-otel/internal/prometheus"
|
||||
"git.tornberg.me/go-otel/internal/sourcemaps"
|
||||
"git.tornberg.me/go-otel/internal/storage"
|
||||
"git.tornberg.me/go-otel/internal/todos"
|
||||
"git.tornberg.me/go-otel/internal/topology"
|
||||
"git.tornberg.me/go-otel/internal/websocket"
|
||||
"go.opentelemetry.io/collector/pdata/plog"
|
||||
@@ -285,6 +286,28 @@ func main() {
|
||||
investigationStore = st
|
||||
}
|
||||
}
|
||||
var todoStore todos.Store
|
||||
if chStore, ok := store.(*storage.ClickHouseStore); ok {
|
||||
if st, err := todos.NewClickHouseStore(context.Background(), chStore.Conn(), chStore.Database()); err != nil {
|
||||
log.Printf("todos: clickhouse unavailable, using file store: %v", err)
|
||||
} else {
|
||||
todoStore = st
|
||||
}
|
||||
}
|
||||
if todoStore == nil {
|
||||
path := os.Getenv("OTEL_TODOS_PATH")
|
||||
if path == "" {
|
||||
path = "otel-todos.jsonl"
|
||||
}
|
||||
if st, err := todos.NewFileStore(path); err != nil {
|
||||
log.Printf("todos disabled: %v", err)
|
||||
} else {
|
||||
todoStore = st
|
||||
}
|
||||
}
|
||||
if todoStore != nil {
|
||||
coll.SetTodoStore(todoStore)
|
||||
}
|
||||
investigator := investigation.NewHandler(investigation.ConfigFromEnv(), investigationStore)
|
||||
abuse := abuseipdb.NewHandler(abuseipdb.ConfigFromEnv())
|
||||
|
||||
@@ -324,6 +347,7 @@ func main() {
|
||||
otelMux.HandleFunc("/v1/logs", withCORS(coll.HandleLogs))
|
||||
otelMux.HandleFunc("/v1/logs/", withCORS(coll.HandleLogs))
|
||||
otelMux.HandleFunc("/v1/vitals", withCORS(coll.HandleVitals))
|
||||
otelMux.HandleFunc("/v1/todos", withCORS(coll.HandleTodoCreate))
|
||||
otelMux.HandleFunc("/health", coll.HandleHealth)
|
||||
|
||||
// UI and API mux (port 8080)
|
||||
@@ -338,6 +362,7 @@ func main() {
|
||||
uiMux.HandleFunc("/v1/logs", withCORS(coll.HandleLogs))
|
||||
uiMux.HandleFunc("/v1/logs/", withCORS(coll.HandleLogs))
|
||||
uiMux.HandleFunc("/v1/vitals", withCORS(coll.HandleVitals))
|
||||
uiMux.HandleFunc("/v1/todos", withCORS(coll.HandleTodoCreate))
|
||||
uiMux.HandleFunc("/health", coll.HandleHealth)
|
||||
uiMux.HandleFunc("GET /internal/honeypot/ips", honeypotTracker.HandleIPs)
|
||||
|
||||
@@ -383,6 +408,7 @@ func main() {
|
||||
uiMux.Handle("PATCH /api/issues/{id}", oidcAuth.RequireAuth(http.HandlerFunc(coll.HandleIssueByID)))
|
||||
uiMux.Handle("GET /api/issues/{id}/similar", oidcAuth.RequireAuth(http.HandlerFunc(coll.HandleIssueSimilar)))
|
||||
uiMux.Handle("POST /api/issues/{id}/similar", oidcAuth.RequireAuth(http.HandlerFunc(coll.HandleSimilarityFeedback)))
|
||||
uiMux.Handle("GET /api/todos", oidcAuth.RequireAuth(http.HandlerFunc(coll.HandleTodoList)))
|
||||
uiMux.Handle("GET /api/patterns", oidcAuth.RequireAuth(http.HandlerFunc(coll.HandlePatterns)))
|
||||
uiMux.Handle("GET /api/topology", oidcAuth.RequireAuth(http.HandlerFunc(topo.HandleTopology)))
|
||||
uiMux.Handle("GET /api/rollouts", oidcAuth.RequireAuth(http.HandlerFunc(coll.HandleRollouts)))
|
||||
|
||||
Reference in new issue
Block a user