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

Enable and disable the examplers storage with flag #6216

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

hiteshwani29
Copy link
Contributor

@hiteshwani29 hiteshwani29 commented Mar 15, 2023

PR closes #5789

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

Changes

Added --tsdb.enable-exemplar-storage flag to enable examples storage. For enabling examples storage we should enable this tsdb.enable-exemplar-storage flag and set value of tsdb.enable-exemplar-storage > 0. To disable examples storage set value of tsdb.enable-exemplar-storage <=0 and disable tsdb.enable-exemplar-storage flag.

Verification

Tested locally

@hiteshwani29 hiteshwani29 changed the title Enable and disable the examplers storage with flag (WIP) Enable and disable the examplers storage with flag Mar 15, 2023
@hiteshwani29 hiteshwani29 force-pushed the enableExamplersFlag branch 2 times, most recently from 795b7f0 to b785a9e Compare March 15, 2023 12:40
@pull-request-size pull-request-size bot added size/S and removed size/M labels Mar 15, 2023
@hiteshwani29 hiteshwani29 force-pushed the enableExamplersFlag branch 2 times, most recently from 5615db5 to fdb4ced Compare March 15, 2023 12:49
@hiteshwani29 hiteshwani29 changed the title (WIP) Enable and disable the examplers storage with flag Enable and disable the examplers storage with flag Mar 15, 2023
@hiteshwani29 hiteshwani29 force-pushed the enableExamplersFlag branch 4 times, most recently from a9bd330 to f9f23b3 Compare March 15, 2023 16:25
@matej-g
Copy link
Collaborator

matej-g commented Mar 15, 2023

Thanks for this @hiteshwani29, but wonder in line with comment #5789 (comment), do we necessarily need a new flag?

@hiteshwani29
Copy link
Contributor Author

hiteshwani29 commented Mar 15, 2023

Yes @matej-g even if we pass --tsdb.max-exemplars=0 it will still enables exempler storage because we are hardcoding this EnableExemplarStorage to true.

If we check this tsdb code https://github.com/prometheus/prometheus/blob/main/tsdb/head_append.go#L56
and https://github.com/prometheus/prometheus/blob/main/tsdb/head_append.go#L144

we can figure out that it enables exempler storage if max-exemplers is <= 0 or EnableExemplarStorage is true
Right now this EnableExemplarStorage is always true so it enables exempler storage even if we pass max-exempler value <=0

@GiedriusS
Copy link
Member

GiedriusS commented Mar 16, 2023

Yes @matej-g even if we pass --tsdb.max-exemplars=0 it will still enables exempler storage because we are hardcoding this EnableExemplarStorage to true.

If we check this tsdb code https://github.com/prometheus/prometheus/blob/main/tsdb/head_append.go#L56 and https://github.com/prometheus/prometheus/blob/main/tsdb/head_append.go#L144

we can figure out that it enables exempler storage if max-exemplers is <= 0 or EnableExemplarStorage is true Right now this EnableExemplarStorage is always true so it enables exempler storage even if we pass max-exempler value <=0

I concur with @matej-g. It looks like setting EnableExemplarStorage: maxExemplars > 0 should do the job, no? 🤔

@hiteshwani29
Copy link
Contributor Author

hiteshwani29 commented Mar 16, 2023 via email

@GiedriusS
Copy link
Member

See my edited message 😄 @hiteshwani29

@hiteshwani29
Copy link
Contributor Author

Yeah 😄 @GiedriusS
Agreed to enable exemplar storage EnableExemplarStorage: true maxExemplars > 0 will do the job
But to disable storage we need to set EnableExemplarStorage: false. We will not able to disable exemplars storage with EnableExemplarStorage: true maxExemplars < 0 with current changes. We should toggle this value as per need. We should not hardcode it to true.

@hiteshwani29
Copy link
Contributor Author

@GiedriusS @matej-g @yeya24 Any update on this PR?

cmd/thanos/receive.go Outdated Show resolved Hide resolved
@hiteshwani29
Copy link
Contributor Author

Did the suggested changes @GiedriusS

@hiteshwani29 hiteshwani29 force-pushed the enableExamplersFlag branch 2 times, most recently from 19b95f1 to 26e520d Compare March 23, 2023 07:07
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: hiteshwani29 <hiteshwani29@gmail.com>
Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

🎖️

Copy link
Contributor

@fpetkovski fpetkovski left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@GiedriusS GiedriusS merged commit fd7bfdb into thanos-io:main Mar 23, 2023
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.

Receive: make exemplars storage a flag
4 participants