Skip to content

Commit

Permalink
Merge branch 'thanos-io:main' into patch-partialResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanshikav123 authored Dec 26, 2023
2 parents d9f3c3f + a59a3ef commit ff97edc
Show file tree
Hide file tree
Showing 26 changed files with 531 additions and 224 deletions.
4 changes: 4 additions & 0 deletions .mdox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ transformations:
backMatter: *docBackMatter

# Non-versioned element: Blog.

- glob: "support/*"
path: /../support/*

- glob: "blog/*"
path: /../blog/*

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6954](https://github.com/thanos-io/thanos/pull/6954) Index Cache: Support tracing for fetch APIs.
- [#6943](https://github.com/thanos-io/thanos/pull/6943) Ruler: Added `keep_firing_for` field in alerting rule.
- [#6972](https://github.com/thanos-io/thanos/pull/6972) Store Gateway: Apply series limit when streaming series for series actually matched if lazy postings is enabled.
- [#6984](https://github.com/thanos-io/thanos/pull/6984) Store Gateway: Added `--store.index-header-lazy-download-strategy` to specify how to lazily download index headers when lazy mmap is enabled.

### Changed

Expand Down
10 changes: 10 additions & 0 deletions cmd/thanos/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

blocksAPI "github.com/thanos-io/thanos/pkg/api/blocks"
"github.com/thanos-io/thanos/pkg/block"
"github.com/thanos-io/thanos/pkg/block/indexheader"
"github.com/thanos-io/thanos/pkg/block/metadata"
"github.com/thanos-io/thanos/pkg/component"
hidden "github.com/thanos-io/thanos/pkg/extflag"
Expand Down Expand Up @@ -89,6 +90,8 @@ type storeConfig struct {
lazyIndexReaderEnabled bool
lazyIndexReaderIdleTimeout time.Duration
lazyExpandedPostingsEnabled bool

indexHeaderLazyDownloadStrategy string
}

func (sc *storeConfig) registerFlag(cmd extkingpin.FlagClause) {
Expand Down Expand Up @@ -186,6 +189,10 @@ func (sc *storeConfig) registerFlag(cmd extkingpin.FlagClause) {
cmd.Flag("store.enable-lazy-expanded-postings", "If true, Store Gateway will estimate postings size and try to lazily expand postings if it downloads less data than expanding all postings.").
Default("false").BoolVar(&sc.lazyExpandedPostingsEnabled)

cmd.Flag("store.index-header-lazy-download-strategy", "Strategy of how to download index headers lazily. Supported values: eager, lazy. If eager, always download index header during initial load. If lazy, download index header during query time.").
Default(string(indexheader.EagerDownloadStrategy)).
EnumVar(&sc.indexHeaderLazyDownloadStrategy, string(indexheader.EagerDownloadStrategy), string(indexheader.LazyDownloadStrategy))

cmd.Flag("web.disable", "Disable Block Viewer UI.").Default("false").BoolVar(&sc.disableWeb)

cmd.Flag("web.external-prefix", "Static prefix for all HTML links and redirect URLs in the bucket web UI interface. Actual endpoints are still served on / or the web.route-prefix. This allows thanos bucket web UI to be served behind a reverse proxy that strips a URL sub-path.").
Expand Down Expand Up @@ -388,6 +395,9 @@ func runStore(
return conf.estimatedMaxChunkSize
}),
store.WithLazyExpandedPostings(conf.lazyExpandedPostingsEnabled),
store.WithIndexHeaderLazyDownloadStrategy(
indexheader.IndexHeaderLazyDownloadStrategy(conf.indexHeaderLazyDownloadStrategy).StrategyToDownloadFunc(),
),
}

if conf.debugLogging {
Expand Down
6 changes: 6 additions & 0 deletions docs/components/store.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ Flags:
DEPRECATED: use store.limits.request-samples.
--store.grpc.touched-series-limit=0
DEPRECATED: use store.limits.request-series.
--store.index-header-lazy-download-strategy=eager
Strategy of how to download index headers
lazily. Supported values: eager, lazy.
If eager, always download index header during
initial load. If lazy, download index header
during query time.
--store.limits.request-samples=0
The maximum samples allowed for a single
Series request, The Series call fails if
Expand Down
4 changes: 4 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ See up to date [jsonnet mixins](https://github.com/thanos-io/thanos/tree/main/mi

## Talks

* 2023
* [Planetscale monitoring: Handling billions of active series with Prometheus and Thanos](https://www.youtube.com/watch?v=Or8r46fSaOg)
* [Taming the Tsunami: low latency ingestion of push-based metrics in Prometheus](https://www.youtube.com/watch?v=W81x1j765hc)

* 2022
* [Story of Correlation: Integrating Thanos Metrics with Observability Signals](https://www.youtube.com/watch?v=rWFb01GW0mQ)
* [Running the Observability As a Service For Your Teams With Thanos](https://www.youtube.com/watch?v=I4Mfyfd_4M8)
Expand Down
6 changes: 6 additions & 0 deletions docs/support/welcome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Welcome to Support and Training!
author: Thanos Team
---

Anyone who has developed a Thanos training program or offers related services can add themselves to this page by opening a pull request against it.
2 changes: 1 addition & 1 deletion pkg/block/indexheader/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestReaders(t *testing.T) {
_, err := WriteBinary(ctx, bkt, id, fn)
testutil.Ok(t, err)

br, err := NewLazyBinaryReader(ctx, log.NewNopLogger(), nil, tmpDir, id, 3, NewLazyBinaryReaderMetrics(nil), NewBinaryReaderMetrics(nil), nil)
br, err := NewLazyBinaryReader(ctx, log.NewNopLogger(), nil, tmpDir, id, 3, NewLazyBinaryReaderMetrics(nil), NewBinaryReaderMetrics(nil), nil, false)
testutil.Ok(t, err)

defer func() { testutil.Ok(t, br.Close()) }()
Expand Down
7 changes: 6 additions & 1 deletion pkg/block/indexheader/lazy_binary_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ type LazyBinaryReader struct {

// Keep track of the last time it was used.
usedAt *atomic.Int64

// If true, index header will be downloaded at query time rather than initialization time.
lazyDownload bool
}

// NewLazyBinaryReader makes a new LazyBinaryReader. If the index-header does not exist
Expand All @@ -99,8 +102,9 @@ func NewLazyBinaryReader(
metrics *LazyBinaryReaderMetrics,
binaryReaderMetrics *BinaryReaderMetrics,
onClosed func(*LazyBinaryReader),
lazyDownload bool,
) (*LazyBinaryReader, error) {
if dir != "" {
if dir != "" && !lazyDownload {
indexHeaderFile := filepath.Join(dir, id.String(), block.IndexHeaderFilename)
// If the index-header doesn't exist we should download it.
if _, err := os.Stat(indexHeaderFile); err != nil {
Expand Down Expand Up @@ -131,6 +135,7 @@ func NewLazyBinaryReader(
binaryReaderMetrics: binaryReaderMetrics,
usedAt: atomic.NewInt64(time.Now().UnixNano()),
onClosed: onClosed,
lazyDownload: lazyDownload,
}, nil
}

Expand Down
Loading

0 comments on commit ff97edc

Please sign in to comment.