github.com/grafana/pyroscope@v1.18.0/pkg/operations/admin.go (about) 1 package operations 2 3 import ( 4 "context" 5 "net/http" 6 "time" 7 8 "github.com/go-kit/log" 9 "github.com/grafana/dskit/services" 10 11 "github.com/grafana/pyroscope/pkg/objstore" 12 ) 13 14 type Admin struct { 15 services.Service 16 logger log.Logger 17 handlers *Handlers 18 } 19 20 func NewAdmin(bucketClient objstore.Bucket, logger log.Logger, maxBlockDuration time.Duration) (*Admin, error) { 21 a := &Admin{ 22 logger: logger, 23 handlers: &Handlers{ 24 Logger: logger, 25 Bucket: bucketClient, 26 MaxBlockDuration: maxBlockDuration, 27 }, 28 } 29 a.Service = services.NewBasicService(nil, a.running, nil) 30 return a, nil 31 } 32 func (a *Admin) running(ctx context.Context) error { 33 <-ctx.Done() 34 return nil 35 } 36 37 func (a *Admin) TenantsHandler(w http.ResponseWriter, r *http.Request) { 38 a.handlers.CreateIndexHandler()(w, r) 39 } 40 41 func (a *Admin) BlocksHandler(w http.ResponseWriter, r *http.Request) { 42 a.handlers.CreateBlocksHandler()(w, r) 43 } 44 45 func (a *Admin) BlockHandler(w http.ResponseWriter, r *http.Request) { 46 a.handlers.CreateBlockDetailsHandler()(w, r) 47 } 48 49 func (a *Admin) DatasetHandler(w http.ResponseWriter, r *http.Request) { 50 http.Error(w, "Dataset details not available in v1 storage", http.StatusNotFound) 51 } 52 53 func (a *Admin) DatasetProfilesHandler(w http.ResponseWriter, r *http.Request) { 54 http.Error(w, "Dataset profiles not available in v1 storage", http.StatusNotFound) 55 } 56 57 func (a *Admin) ProfileDownloadHandler(w http.ResponseWriter, r *http.Request) { 58 http.Error(w, "Profile download not available in v1 storage", http.StatusNotFound) 59 } 60 61 func (a *Admin) ProfileCallTreeHandler(w http.ResponseWriter, r *http.Request) { 62 http.Error(w, "Profile call tree not available in v1 storage", http.StatusNotFound) 63 } 64 65 func (a *Admin) DatasetTSDBIndexHandler(w http.ResponseWriter, r *http.Request) { 66 http.Error(w, "Dataset TSDB index not available in v1 storage", http.StatusNotFound) 67 } 68 69 func (a *Admin) DatasetSymbolsHandler(w http.ResponseWriter, r *http.Request) { 70 http.Error(w, "Dataset symbols not available in v1 storage", http.StatusNotFound) 71 }