Skip to content

Commit

Permalink
cr: inline the component usage
Browse files Browse the repository at this point in the history
  • Loading branch information
FUSAKLA committed Aug 14, 2019
1 parent 3b2d411 commit 5ff4082
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
7 changes: 3 additions & 4 deletions cmd/thanos/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ func (cs compactionSet) maxLevel() int {
}

func registerCompact(m map[string]setupFunc, app *kingpin.Application) {
comp := component.Compact
cmd := app.Command(comp.String(), "continuously compacts blocks in an object store bucket")
cmd := app.Command(component.Compact.String(), "continuously compacts blocks in an object store bucket")

haltOnError := cmd.Flag("debug.halt-on-error", "Halt the process if a critical compaction error is detected.").
Hidden().Default("true").Bool()
Expand Down Expand Up @@ -112,7 +111,7 @@ func registerCompact(m map[string]setupFunc, app *kingpin.Application) {
compactionConcurrency := cmd.Flag("compact.concurrency", "Number of goroutines to use when compacting groups.").
Default("1").Int()

m[comp.String()] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ bool) error {
m[component.Compact.String()] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ bool) error {
return runCompact(g, logger, reg,
*httpAddr,
*dataDir,
Expand All @@ -127,7 +126,7 @@ func registerCompact(m map[string]setupFunc, app *kingpin.Application) {
compact.ResolutionLevel5m: time.Duration(*retention5m),
compact.ResolutionLevel1h: time.Duration(*retention1h),
},
comp,
component.Compact,
*disableDownsampling,
*maxCompactionLevel,
*blockSyncConcurrency,
Expand Down
10 changes: 4 additions & 6 deletions cmd/thanos/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"sync"
"time"

"github.com/thanos-io/thanos/pkg/prober"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/oklog/run"
Expand All @@ -21,6 +19,7 @@ import (
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/component"
"github.com/thanos-io/thanos/pkg/objstore/client"
"github.com/thanos-io/thanos/pkg/prober"
"github.com/thanos-io/thanos/pkg/promclient"
"github.com/thanos-io/thanos/pkg/reloader"
"github.com/thanos-io/thanos/pkg/runutil"
Expand All @@ -34,8 +33,7 @@ import (
const waitForExternalLabelsTimeout = 10 * time.Minute

func registerSidecar(m map[string]setupFunc, app *kingpin.Application) {
comp := component.Sidecar
cmd := app.Command(comp.String(), "sidecar for Prometheus server")
cmd := app.Command(component.Sidecar.String(), "sidecar for Prometheus server")

grpcBindAddr, httpBindAddr, cert, key, clientCA := regCommonServerFlags(cmd)

Expand All @@ -57,7 +55,7 @@ func registerSidecar(m map[string]setupFunc, app *kingpin.Application) {

uploadCompacted := cmd.Flag("shipper.upload-compacted", "[Experimental] If true sidecar will try to upload compacted blocks as well. Useful for migration purposes. Works only if compaction is disabled on Prometheus.").Default("false").Hidden().Bool()

m[comp.String()] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ bool) error {
m[component.Sidecar.String()] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ bool) error {
rl := reloader.New(
log.With(logger, "component", "reloader"),
reloader.ReloadURLFromBase(*promURL),
Expand All @@ -80,7 +78,7 @@ func registerSidecar(m map[string]setupFunc, app *kingpin.Application) {
objStoreConfig,
rl,
*uploadCompacted,
comp,
component.Sidecar,
)
}
}
Expand Down

0 comments on commit 5ff4082

Please sign in to comment.