Skip to content

Commit

Permalink
Add bucket inspect timeout flag (#1533)
Browse files Browse the repository at this point in the history
* Add bucket inspect timeout.

Signed-off-by: Johnathan Falk <johnathan.falk@gmail.com>

* Added change log entry.

Signed-off-by: Johnathan Falk <johnathan.falk@gmail.com>
  • Loading branch information
jdfalk authored and bwplotka committed Sep 17, 2019
1 parent bfb5645 commit b7739b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ We use *breaking* word for marking changes that are not backward compatible (rel

## Unreleased

## Added
-[1533](https://github.com/thanos-io/thanos/pull/1533) Thanos inspect now supports the timeout flag.

### Fixed

-[#1525](https://github.com/thanos-io/thanos/pull/1525) Thanos now deletes block's file in correct order allowing to detect partial blocks without problems.
Expand Down
3 changes: 2 additions & 1 deletion cmd/thanos/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func registerBucketInspect(m map[string]setupFunc, root *kingpin.CmdClause, name
PlaceHolder("<name>=\\\"<value>\\\"").Strings()
sortBy := cmd.Flag("sort-by", "Sort by columns. It's also possible to sort by multiple columns, e.g. '--sort-by FROM --sort-by UNTIL'. I.e., if the 'FROM' value is equal the rows are then further sorted by the 'UNTIL' value.").
Default("FROM", "UNTIL").Enums(inspectColumns...)
timeout := cmd.Flag("timeout", "Timeout to download metadata from remote storage").Default("5m").Duration()

m[name+" inspect"] = func(g *run.Group, logger log.Logger, reg *prometheus.Registry, _ opentracing.Tracer, _ bool) error {

Expand All @@ -271,7 +272,7 @@ func registerBucketInspect(m map[string]setupFunc, root *kingpin.CmdClause, name

defer runutil.CloseWithLogOnErr(logger, bkt, "bucket client")

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
ctx, cancel := context.WithTimeout(context.Background(), *timeout)
defer cancel()

// Getting Metas.
Expand Down
1 change: 1 addition & 0 deletions docs/components/bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@ Flags:
multiple columns, e.g. '--sort-by FROM --sort-by
UNTIL'. I.e., if the 'FROM' value is equal the rows
are then further sorted by the 'UNTIL' value.
--timeout=5m Timeout to download metadata from remote storage
```

0 comments on commit b7739b7

Please sign in to comment.