mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-03 10:42:00 +08:00
Add API endpoint to fetch redis info
This commit is contained in:
9
main.go
9
main.go
@@ -8,6 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/rs/cors"
|
||||
@@ -64,6 +65,11 @@ func main() {
|
||||
})
|
||||
defer inspector.Close()
|
||||
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Addr: "localhost:6379",
|
||||
})
|
||||
defer rdb.Close()
|
||||
|
||||
router := mux.NewRouter()
|
||||
router.Use(loggingMiddleware)
|
||||
|
||||
@@ -119,6 +125,9 @@ func main() {
|
||||
api.HandleFunc("/scheduler_entries", newListSchedulerEntriesHandlerFunc(inspector)).Methods("GET")
|
||||
api.HandleFunc("/scheduler_entries/{entry_id}/enqueue_events", newListSchedulerEnqueueEventsHandlerFunc(inspector)).Methods("GET")
|
||||
|
||||
// Redis info endpoint.
|
||||
api.HandleFunc("/redis_info", newRedisInfoHandlerFunc(rdb)).Methods("GET")
|
||||
|
||||
fs := &staticFileServer{staticPath: "ui/build", indexPath: "index.html"}
|
||||
router.PathPrefix("/").Handler(fs)
|
||||
|
||||
|
Reference in New Issue
Block a user