Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Ganesh Vernekar <[email protected]>
  • Loading branch information
codesome committed May 15, 2020
1 parent 6e7a9c6 commit 32392d7
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 113 deletions.
12 changes: 6 additions & 6 deletions cmd/thanos/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func registerReceive(m map[string]setupFunc, app *kingpin.Application) {

objStoreConfig := regCommonObjStoreFlags(cmd, "", false)

retention := cmd.Flag("tsdb.retention", "How long to retain raw samples on local storage. 0d - disables this retention").Default("15d").Int64()
retention := cmd.Flag("tsdb.retention", "How long to retain raw samples on local storage. 0d - disables this retention").Default("15d").Duration()

hashringsFile := cmd.Flag("receive.hashrings-file", "Path to file that contains the hashring configuration.").
PlaceHolder("<path>").String()
Expand All @@ -81,8 +81,8 @@ func registerReceive(m map[string]setupFunc, app *kingpin.Application) {

replicationFactor := cmd.Flag("receive.replication-factor", "How many times to replicate incoming write requests.").Default("1").Uint64()

tsdbMinBlockDuration := cmd.Flag("tsdb.min-block-duration", "Min duration for local TSDB blocks").Default("2h").Hidden().Int64()
tsdbMaxBlockDuration := cmd.Flag("tsdb.max-block-duration", "Max duration for local TSDB blocks").Default("2h").Hidden().Int64()
tsdbMinBlockDuration := cmd.Flag("tsdb.min-block-duration", "Min duration for local TSDB blocks").Default("2h").Hidden().Duration()
tsdbMaxBlockDuration := cmd.Flag("tsdb.max-block-duration", "Max duration for local TSDB blocks").Default("2h").Hidden().Duration()
ignoreBlockSize := cmd.Flag("shipper.ignore-unequal-block-size", "If true receive will not require min and max block size flags to be set to the same value. Only use this if you want to keep long retention and compaction enabled, as in the worst case it can result in ~2h data loss for your Thanos bucket storage.").Default("false").Hidden().Bool()

walCompression := cmd.Flag("tsdb.wal-compression", "Compress the tsdb WAL.").Default("true").Bool()
Expand All @@ -102,9 +102,9 @@ func registerReceive(m map[string]setupFunc, app *kingpin.Application) {
}

tsdbOpts := &tsdb.Options{
MinBlockDuration: *tsdbMinBlockDuration / int64(time.Millisecond),
MaxBlockDuration: *tsdbMaxBlockDuration / int64(time.Millisecond),
RetentionDuration: *retention / int64(time.Millisecond),
MinBlockDuration: int64(*tsdbMinBlockDuration / time.Millisecond),
MaxBlockDuration: int64(*tsdbMaxBlockDuration / time.Millisecond),
RetentionDuration: int64(*retention / time.Millisecond),
NoLockfile: true,
WALCompression: *walCompression,
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/thanos/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func registerRule(m map[string]setupFunc, app *kingpin.Application) {
evalInterval := modelDuration(cmd.Flag("eval-interval", "The default evaluation interval to use.").
Default("30s"))
tsdbBlockDuration := cmd.Flag("tsdb.block-duration", "Block duration for TSDB block.").
Default("2h").Int64()
Default("2h").Duration()
tsdbRetention := cmd.Flag("tsdb.retention", "Block retention time on local disk.").
Default("48h").Int64()
Default("48h").Duration()

walCompression := cmd.Flag("tsdb.wal-compression", "Compress the tsdb WAL.").Default("true").Bool()

Expand Down Expand Up @@ -125,9 +125,9 @@ func registerRule(m map[string]setupFunc, app *kingpin.Application) {
}

tsdbOpts := &tsdb.Options{
MinBlockDuration: *tsdbBlockDuration / int64(time.Millisecond),
MaxBlockDuration: *tsdbBlockDuration / int64(time.Millisecond),
RetentionDuration: *tsdbRetention / int64(time.Millisecond),
MinBlockDuration: int64(*tsdbBlockDuration / time.Millisecond),
MaxBlockDuration: int64(*tsdbBlockDuration / time.Millisecond),
RetentionDuration: int64(*tsdbRetention / time.Millisecond),
NoLockfile: true,
WALCompression: *walCompression,
}
Expand Down
29 changes: 0 additions & 29 deletions cmd/thanos/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,3 @@ func checkRules(logger log.Logger, filename string) (int, tsdb_errors.MultiError

return numRules, checkErrors
}

//func thanosRuleGroupsToPromRuleGroups(ruleGroups ThanosRuleGroups) rulefmt.RuleGroups {
// promRuleGroups := rulefmt.RuleGroups{Groups: []rulefmt.RuleGroup{}}
// for _, g := range ruleGroups.Groups {
// group := rulefmt.RuleGroup{
// Name: g.Name,
// Interval: g.Interval,
// Rules: []rulefmt.RuleNode{},
// }
// for _, r := range g.Rules {
// group.Rules = append(
// group.Rules,
// rulefmt.RuleNode{
// Record: r.Record,
// Alert: r.Alert,
// Expr: r.Expr,
// For: r.For,
// Labels: r.Labels,
// Annotations: r.Annotations,
// },
// )
// }
// promRuleGroups.Groups = append(
// promRuleGroups.Groups,
// group,
// )
// }
// return promRuleGroups
//}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ require (
replace (
// Mitigation for: https://github.com/Azure/go-autorest/issues/414
github.com/Azure/go-autorest => github.com/Azure/go-autorest v12.3.0+incompatible
// Make sure Cortex is not forcing us to some other Prometheus version.
github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.8.2-0.20200407102557-cd73b3d33e06 // @cd73b3d33e064bbd846fc7a26dc8c313d46af382 (after v2.17.0 and before v2.18.0).
k8s.io/api => k8s.io/api v0.0.0-20190620084959-7cf5895f2711
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190620085554-14e95df34f1f
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719
Expand Down
Loading

0 comments on commit 32392d7

Please sign in to comment.