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

sidecar: Allow customizing the shipper metadata file name #6886

Merged

Conversation

sinkingpoint
Copy link
Contributor

@sinkingpoint sinkingpoint commented Nov 10, 2023

Currently, the shipper metadata file is always called thanos.shipper.json in the Prometheus data directory. This precludes running multiple sidecars that upload to different object stores, as they will overwrite each other's metadata file.

This commit allows the metadata file name to be customized via a flag. The default is unchanged, but it can be overridden with the --shipper.meta-file-name flag.

As part of this, we update the signatures of WriteMetaFile and ReadMetaFile to take the full path of the metadata file, rather than just the directory, and updates the tests that go along with this.

The previous guidance on doing this was to run a single sidecar to upload to one object storage, and then sync that across to a second. In our case our sidecars run outside the clouds that store our data, so doing this becomes cost prohibitive as we have to pay egress fees from one cloud to the other. Uploading to both from our Prometheus is much cheaper as ingress is orders or magnitude less expensive.

A few questions on the implementation here:

  • This ties the Read/Write methods pretty closely to the shipper itself. Does it make sense to move them under it?
  • This changes the metadata file, but two sidecars still share an /upload directory. From my testing this doesn't seem to have much of an effect, but I can imagine issues where two sidecars are uploading the same block, and one removes it from the upload directory before the other is done. Does it make sense to allow customizing that as well, or somehow derive it from the shipper file?
  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

  • Add a shipper.meta-file-name flag, allowing customizing the shipper meta file path, and allowing sidecars to co-exist

Verification

Mostly submitting this to get comments on the approach for now. We run a variant of this at Cloudflare, but less formal. I'm testing this patch precisely next week. For now, I'll a test one to test the customization

@sinkingpoint sinkingpoint force-pushed the sinkingpoint/custom-shipper-paths branch 3 times, most recently from d2f8df5 to d93eccf Compare November 11, 2023 00:33
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, this makes sense to me.

Currently, the shipper metadata file is always called `thanos.shipper.json`
in the Prometheus data directory. This precludes running multiple sidecars
that upload to different object stores, as they will overwrite each other's
metadata file.

This commit allows the metadata file name to be customized via a flag. The
default is unchanged, but it can be overridden with the `--shipper.meta-file-name`
flag.

As part of this, we update the signatures of `WriteMetaFile` and `ReadMetaFile`
to take the full path of the metadata file, rather than just the directory,
and updates the tests that go along with this.

Signed-off-by: sinkingpoint <[email protected]>
@sinkingpoint sinkingpoint force-pushed the sinkingpoint/custom-shipper-paths branch from d93eccf to c1305d3 Compare November 16, 2023 03:33
@sinkingpoint
Copy link
Contributor Author

Seems like the doc test is unrelated?

@fpetkovski
Copy link
Contributor

Yeah seems to be either flaky or broken for some other reason.

@fpetkovski fpetkovski merged commit fb18026 into thanos-io:main Nov 16, 2023
15 of 16 checks passed
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.

3 participants