Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive: Reload tenant limit configuration on file change #5673

Merged
merged 37 commits into from Oct 17, 2022

Conversation

douglascamata
Copy link
Contributor

@douglascamata douglascamata commented Sep 5, 2022

Signed-off-by: Douglas Camata 159076+douglascamata@users.noreply.github.com

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

  • Isolate the limiting logic in Receive into its own package pkg/receive/limits.
  • Tenant limit configuration reload when it changes without having to restart Receive.

Future work

  • After this is merged and this new function is proven to be working well, an issue can be created to track the migration of the logic into https://github.com/efficientgo/tools/tree/main/extkingpin and its usage in all other configuration reloads throughout the project.
  • Add file hash checking to ensure we only reload the configuration if the contents of the file are changed.
  • Contribute some fixes (i.e. the reload skip logic fix) and features (i.e. the debouncer) to Prometheus file discovery

Verification

  • Unit tests
  • Local tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
…ent-reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
matej-g
matej-g previously approved these changes Oct 11, 2022
Copy link
Collaborator

@matej-g matej-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing everything @douglascamata ❤️, approving with my minor objections (#5673 (review)), which is fine since we agreed to tackle it separately 👍

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
@douglascamata
Copy link
Contributor Author

Hey @matej-g, can you re-review please? I had to fix duplicated metrics collector register errors when config reloads were triggered by using the UnRegisterer (see fd98829). Related to the upgrade to Prometheus v2.39.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 💪🏽

@bwplotka
Copy link
Member

My only concerns is as @matej-g mentioned - what we do about

type ConfigWatcher struct {
- sounds like with this PR we have two ways of doing the same thing (reloading from file). What's the direction here to unify this? (:

@douglascamata
Copy link
Contributor Author

  • sounds like with this PR we have two ways of doing the same thing (reloading from file). What's the direction here to unify this? (:

@bwplotka as mentioned in the Future Work section & comments of this PR and some of the Thanos Community Meetings, the plan is to unify all the implementations over time. First I would like to confirm this one is correct and stable, which is difficult considering the complexity & gotchas of all the different backends of fsnotify but not impossible. Then, in case everything goes well, smaller PRs can follow migrating every other configuration reload system.

I do not want to open a single huge PR migrating everything to a brand new system that didn't prove itself yet. Even I would possibly not approve such PR. 😄

@matej-g matej-g merged commit a3e246c into thanos-io:main Oct 17, 2022
utukJ pushed a commit to utukJ/thanos that referenced this pull request Oct 18, 2022
…5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>
utukJ added a commit to utukJ/thanos that referenced this pull request Oct 18, 2022
utukJ added a commit to utukJ/thanos that referenced this pull request Oct 18, 2022
…anos-io#5673)"

This reverts commit 24e1cc0.

Signed-off-by: utukj <utukphd@gmail.com>
utukJ pushed a commit to utukJ/thanos that referenced this pull request Oct 18, 2022
…5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>
utukJ added a commit to utukJ/thanos that referenced this pull request Oct 18, 2022
…anos-io#5673)"

This reverts commit 32ca327.

Signed-off-by: utukj <utukphd@gmail.com>
GiedriusS added a commit that referenced this pull request Oct 27, 2022
…specify metric labels to collect (#5785)

* added unit tests for long labels and no external labels

Signed-off-by: utukj <utukphd@gmail.com>

* trimmed too long external labels

Signed-off-by: utukj <utukphd@gmail.com>

* added optional label selection

Signed-off-by: utukj <utukphd@gmail.com>

* added cmd flag for choosing metric labels

Signed-off-by: utukj <utukphd@gmail.com>

* updated docs

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset.go

full sentence fix

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* minor fixes from code review

Signed-off-by: utukj <utukphd@gmail.com>

* fixed code comments

Signed-off-by: utukj <utukphd@gmail.com>

* used enum for labels

Signed-off-by: utukj <utukphd@gmail.com>

* updated query docs

Signed-off-by: utukj <utukphd@gmail.com>

* cleaned up tests

Signed-off-by: utukj <utukphd@gmail.com>

* Updates busybox SHA (#5793)

Signed-off-by: GitHub <noreply@github.com>

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Receive: Reload tenant limit configuration on file change (#5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Query: add query metrics to calls going through the Store API (#5741)

* Implement granular query performance metrics for Thanos Query

These are grabbed from the data returned by multiple Store APIs after execution of a query.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix some linter warnings

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix long function definition (newQuerier)

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove TODO comment

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reformat query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless return

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back old query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update query docs again

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix e2e env name

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright notice.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Bump wait time to twice scrape interval

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Attempt to fix randomly failing test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Checking more metrics to ensure the store is ready

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Clean up test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Do not record store api metrics when didn't touch series or samples

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Also skip store api metrics on zero chunks touched

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update changelog

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix broken changelog after merge

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove extra empty line

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor names and (un)exported types and fields

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Start listing metrics exported by Thanos Query

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Rename pkg/store/metrics -> pkg/store/telemetry

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of the pkg/store/telemetry package

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* docs: mark me as shepherd for next release (#5797)

Let's release the RC on Friday.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Revert "docs: mark me as shepherd for next release (#5797)"

This reverts commit ea646a6.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Query: add query metrics to calls going through the Store API (#5741)"

This reverts commit eec4fd0.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Receive: Reload tenant limit configuration on file change (#5673)"

This reverts commit 24e1cc0.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Updates busybox SHA (#5793)"

This reverts commit 9474c00.

Signed-off-by: utukj <utukphd@gmail.com>

* Updates busybox SHA (#5793)

Signed-off-by: GitHub <noreply@github.com>

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Receive: Reload tenant limit configuration on file change (#5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Query: add query metrics to calls going through the Store API (#5741)

* Implement granular query performance metrics for Thanos Query

These are grabbed from the data returned by multiple Store APIs after execution of a query.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix some linter warnings

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix long function definition (newQuerier)

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove TODO comment

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reformat query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless return

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back old query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update query docs again

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix e2e env name

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright notice.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Bump wait time to twice scrape interval

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Attempt to fix randomly failing test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Checking more metrics to ensure the store is ready

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Clean up test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Do not record store api metrics when didn't touch series or samples

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Also skip store api metrics on zero chunks touched

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update changelog

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix broken changelog after merge

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove extra empty line

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor names and (un)exported types and fields

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Start listing metrics exported by Thanos Query

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Rename pkg/store/metrics -> pkg/store/telemetry

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of the pkg/store/telemetry package

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* docs: mark me as shepherd for next release (#5797)

Let's release the RC on Friday.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Revert "docs: mark me as shepherd for next release (#5797)"

This reverts commit c509c0e.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Updates busybox SHA (#5793)"

This reverts commit ad11a03.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Query: add query metrics to calls going through the Store API (#5741)"

This reverts commit 7a77769.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Receive: Reload tenant limit configuration on file change (#5673)"

This reverts commit 32ca327.

Signed-off-by: utukj <utukphd@gmail.com>

* fixed lint issue

Signed-off-by: utukj <utukphd@gmail.com>

* added unit test for truncate and clean up

Signed-off-by: utukj <utukphd@gmail.com>

* fixed truncate label func and added more tests

Signed-off-by: utukj <utukphd@gmail.com>

* removed name from truncate test

Signed-off-by: utukj <utukphd@gmail.com>

* reorganized test cases and removed redundant comments

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* fixed failing checks

Signed-off-by: utukj <utukphd@gmail.com>

* e2e: Adding test for querier with two stores loadbalancing across them.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* dumped long expected output in unittest

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "e2e: Adding test for querier with two stores loadbalancing across them."

This reverts commit 96b1545.

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* moved label definition to endpointset

Signed-off-by: utukj <utukphd@gmail.com>

Signed-off-by: utukj <utukphd@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Co-authored-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
GiedriusS added a commit to vinted/thanos that referenced this pull request Oct 31, 2022
…specify metric labels to collect (thanos-io#5785)

* added unit tests for long labels and no external labels

Signed-off-by: utukj <utukphd@gmail.com>

* trimmed too long external labels

Signed-off-by: utukj <utukphd@gmail.com>

* added optional label selection

Signed-off-by: utukj <utukphd@gmail.com>

* added cmd flag for choosing metric labels

Signed-off-by: utukj <utukphd@gmail.com>

* updated docs

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset.go

full sentence fix

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* minor fixes from code review

Signed-off-by: utukj <utukphd@gmail.com>

* fixed code comments

Signed-off-by: utukj <utukphd@gmail.com>

* used enum for labels

Signed-off-by: utukj <utukphd@gmail.com>

* updated query docs

Signed-off-by: utukj <utukphd@gmail.com>

* cleaned up tests

Signed-off-by: utukj <utukphd@gmail.com>

* Updates busybox SHA (thanos-io#5793)

Signed-off-by: GitHub <noreply@github.com>

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Receive: Reload tenant limit configuration on file change (thanos-io#5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Query: add query metrics to calls going through the Store API (thanos-io#5741)

* Implement granular query performance metrics for Thanos Query

These are grabbed from the data returned by multiple Store APIs after execution of a query.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix some linter warnings

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix long function definition (newQuerier)

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove TODO comment

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reformat query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless return

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back old query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update query docs again

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix e2e env name

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright notice.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Bump wait time to twice scrape interval

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Attempt to fix randomly failing test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Checking more metrics to ensure the store is ready

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Clean up test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Do not record store api metrics when didn't touch series or samples

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Also skip store api metrics on zero chunks touched

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update changelog

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix broken changelog after merge

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove extra empty line

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor names and (un)exported types and fields

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Start listing metrics exported by Thanos Query

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Rename pkg/store/metrics -> pkg/store/telemetry

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of the pkg/store/telemetry package

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* docs: mark me as shepherd for next release (thanos-io#5797)

Let's release the RC on Friday.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Revert "docs: mark me as shepherd for next release (thanos-io#5797)"

This reverts commit ea646a6.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Query: add query metrics to calls going through the Store API (thanos-io#5741)"

This reverts commit eec4fd0.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Receive: Reload tenant limit configuration on file change (thanos-io#5673)"

This reverts commit 24e1cc0.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Updates busybox SHA (thanos-io#5793)"

This reverts commit 9474c00.

Signed-off-by: utukj <utukphd@gmail.com>

* Updates busybox SHA (thanos-io#5793)

Signed-off-by: GitHub <noreply@github.com>

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Receive: Reload tenant limit configuration on file change (thanos-io#5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Query: add query metrics to calls going through the Store API (thanos-io#5741)

* Implement granular query performance metrics for Thanos Query

These are grabbed from the data returned by multiple Store APIs after execution of a query.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix some linter warnings

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix long function definition (newQuerier)

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove TODO comment

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reformat query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless return

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back old query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update query docs again

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix e2e env name

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright notice.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Bump wait time to twice scrape interval

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Attempt to fix randomly failing test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Checking more metrics to ensure the store is ready

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Clean up test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Do not record store api metrics when didn't touch series or samples

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Also skip store api metrics on zero chunks touched

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update changelog

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix broken changelog after merge

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove extra empty line

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor names and (un)exported types and fields

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Start listing metrics exported by Thanos Query

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Rename pkg/store/metrics -> pkg/store/telemetry

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of the pkg/store/telemetry package

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* docs: mark me as shepherd for next release (thanos-io#5797)

Let's release the RC on Friday.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Revert "docs: mark me as shepherd for next release (thanos-io#5797)"

This reverts commit c509c0e.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Updates busybox SHA (thanos-io#5793)"

This reverts commit ad11a03.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Query: add query metrics to calls going through the Store API (thanos-io#5741)"

This reverts commit 7a77769.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Receive: Reload tenant limit configuration on file change (thanos-io#5673)"

This reverts commit 32ca327.

Signed-off-by: utukj <utukphd@gmail.com>

* fixed lint issue

Signed-off-by: utukj <utukphd@gmail.com>

* added unit test for truncate and clean up

Signed-off-by: utukj <utukphd@gmail.com>

* fixed truncate label func and added more tests

Signed-off-by: utukj <utukphd@gmail.com>

* removed name from truncate test

Signed-off-by: utukj <utukphd@gmail.com>

* reorganized test cases and removed redundant comments

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* fixed failing checks

Signed-off-by: utukj <utukphd@gmail.com>

* e2e: Adding test for querier with two stores loadbalancing across them.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* dumped long expected output in unittest

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "e2e: Adding test for querier with two stores loadbalancing across them."

This reverts commit 96b1545.

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* moved label definition to endpointset

Signed-off-by: utukj <utukphd@gmail.com>

Signed-off-by: utukj <utukphd@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Co-authored-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
ngraham20 pushed a commit to ngraham20/thanos that referenced this pull request May 18, 2023
…specify metric labels to collect (thanos-io#5785)

* added unit tests for long labels and no external labels

Signed-off-by: utukj <utukphd@gmail.com>

* trimmed too long external labels

Signed-off-by: utukj <utukphd@gmail.com>

* added optional label selection

Signed-off-by: utukj <utukphd@gmail.com>

* added cmd flag for choosing metric labels

Signed-off-by: utukj <utukphd@gmail.com>

* updated docs

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset.go

full sentence fix

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* minor fixes from code review

Signed-off-by: utukj <utukphd@gmail.com>

* fixed code comments

Signed-off-by: utukj <utukphd@gmail.com>

* used enum for labels

Signed-off-by: utukj <utukphd@gmail.com>

* updated query docs

Signed-off-by: utukj <utukphd@gmail.com>

* cleaned up tests

Signed-off-by: utukj <utukphd@gmail.com>

* Updates busybox SHA (thanos-io#5793)

Signed-off-by: GitHub <noreply@github.com>

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Receive: Reload tenant limit configuration on file change (thanos-io#5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Query: add query metrics to calls going through the Store API (thanos-io#5741)

* Implement granular query performance metrics for Thanos Query

These are grabbed from the data returned by multiple Store APIs after execution of a query.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix some linter warnings

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix long function definition (newQuerier)

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove TODO comment

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reformat query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless return

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back old query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update query docs again

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix e2e env name

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright notice.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Bump wait time to twice scrape interval

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Attempt to fix randomly failing test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Checking more metrics to ensure the store is ready

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Clean up test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Do not record store api metrics when didn't touch series or samples

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Also skip store api metrics on zero chunks touched

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update changelog

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix broken changelog after merge

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove extra empty line

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor names and (un)exported types and fields

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Start listing metrics exported by Thanos Query

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Rename pkg/store/metrics -> pkg/store/telemetry

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of the pkg/store/telemetry package

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* docs: mark me as shepherd for next release (thanos-io#5797)

Let's release the RC on Friday.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Revert "docs: mark me as shepherd for next release (thanos-io#5797)"

This reverts commit ea646a6.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Query: add query metrics to calls going through the Store API (thanos-io#5741)"

This reverts commit eec4fd0.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Receive: Reload tenant limit configuration on file change (thanos-io#5673)"

This reverts commit 24e1cc0.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Updates busybox SHA (thanos-io#5793)"

This reverts commit 9474c00.

Signed-off-by: utukj <utukphd@gmail.com>

* Updates busybox SHA (thanos-io#5793)

Signed-off-by: GitHub <noreply@github.com>

Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Receive: Reload tenant limit configuration on file change (thanos-io#5673)

* Create a PathOrContent reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add docs to staticPathContent.Rewrite

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run goimports

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Properly cancel the context in the test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Watch parent directory of file

This helps handling deletes and other situations.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless ctx.Done()

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add a debounce timer to config reload

It helps managing situations where a create event is followed by a write or when a big file write is sent by the fsnotify backend as many write events.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix event.Op bitmask check

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update lastReload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix debouncer for path content reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Improve documentation of the PathContentRealoder

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Dain reload timer before resetting

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Run tests in parallel

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify debouncing logic

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add more tests to file reloader

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Simplify condition for triggering reload

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use absolute path to config file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of parallel test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back 2s wait between fs operations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless sleep

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Stop reloadTimer when context cancelled

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove unused fucntion

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright to test file

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Auto-reload tenant limit config on file changes

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Wrap error when reloading config

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Move limiter config reloader and update logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of useless types and allocations

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove errorChan from config reload starter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Use UnRegisterer in the Limiter

To ensure that limit reloads will be able to re-register their metrics.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Better guard against nil registerer in the limiter

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove wrong nil guard

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Query: add query metrics to calls going through the Store API (thanos-io#5741)

* Implement granular query performance metrics for Thanos Query

These are grabbed from the data returned by multiple Store APIs after execution of a query.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix some linter warnings

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless logs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix long function definition (newQuerier)

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove TODO comment

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix query tests

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reformat query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove useless return

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Put back old query docs

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update query docs again

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix e2e env name

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Add missing copyright notice.

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Bump wait time to twice scrape interval

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Attempt to fix randomly failing test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Checking more metrics to ensure the store is ready

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Clean up test

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Do not record store api metrics when didn't touch series or samples

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Retrigger CI

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Also skip store api metrics on zero chunks touched

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Update changelog

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Fix broken changelog after merge

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Remove extra empty line

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Refactor names and (un)exported types and fields

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Start listing metrics exported by Thanos Query

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Rename pkg/store/metrics -> pkg/store/telemetry

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Get rid of the pkg/store/telemetry package

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: utukj <utukphd@gmail.com>

* docs: mark me as shepherd for next release (thanos-io#5797)

Let's release the RC on Friday.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: utukj <utukphd@gmail.com>

* Revert "docs: mark me as shepherd for next release (thanos-io#5797)"

This reverts commit c509c0e.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Updates busybox SHA (thanos-io#5793)"

This reverts commit ad11a03.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Query: add query metrics to calls going through the Store API (thanos-io#5741)"

This reverts commit 7a77769.

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "Receive: Reload tenant limit configuration on file change (thanos-io#5673)"

This reverts commit 32ca327.

Signed-off-by: utukj <utukphd@gmail.com>

* fixed lint issue

Signed-off-by: utukj <utukphd@gmail.com>

* added unit test for truncate and clean up

Signed-off-by: utukj <utukphd@gmail.com>

* fixed truncate label func and added more tests

Signed-off-by: utukj <utukphd@gmail.com>

* removed name from truncate test

Signed-off-by: utukj <utukphd@gmail.com>

* reorganized test cases and removed redundant comments

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* fixed failing checks

Signed-off-by: utukj <utukphd@gmail.com>

* e2e: Adding test for querier with two stores loadbalancing across them.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* dumped long expected output in unittest

Signed-off-by: utukj <utukphd@gmail.com>

* Revert "e2e: Adding test for querier with two stores loadbalancing across them."

This reverts commit 96b1545.

Signed-off-by: utukj <utukphd@gmail.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* Update pkg/query/endpointset_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>

* moved label definition to endpointset

Signed-off-by: utukj <utukphd@gmail.com>

Signed-off-by: utukj <utukphd@gmail.com>
Signed-off-by: Uwakmfon Utuk <41128987+utukJ@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Signed-off-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: yeya24 <yeya24@users.noreply.github.com>
Co-authored-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com>
Co-authored-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants