forked from parca-dev/parca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
all.go
39 lines (31 loc) · 1.09 KB
/
all.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
package main
import (
"net/http"
"github.com/go-kit/kit/log"
"github.com/oklog/run"
opentracing "github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
// registerAll registers the all command.
func registerAll(m map[string]setupFunc, app *kingpin.Application, name string) {
cmd := app.Command(name, "All in one command.")
storagePath := cmd.Flag("storage.path", "Directory to read storage from.").
Default("./data").String()
configFile := cmd.Flag("config.file", "Config file to use.").
Default("conprof.yaml").String()
m[name] = func(g *run.Group, mux *http.ServeMux, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, debugLogging bool) error {
return runAll(g, mux, logger, *storagePath, *configFile)
}
}
func runAll(g *run.Group, mux *http.ServeMux, logger log.Logger, storagePath, configFile string) error {
err := runSampler(g, logger, storagePath, configFile)
if err != nil {
return err
}
err = runWeb(mux, logger, storagePath)
if err != nil {
return err
}
return nil
}