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

Fix metricBucket losing object size in Upload #77

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

andyasp
Copy link
Contributor

@andyasp andyasp commented Sep 20, 2023

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

Changes

In metricBucket's Upload the reader was being wrapped with io.NopCloser, but newTimingReadCloser will call TryToGetSize here and then get an error.

I noticed this because I saw this in a test's log message (reference)

21:56:01 alertmanager-1: ts=2023-09-18T21:56:01.855369927Z caller=s3.go:487 level=warn msg="could not guess file size for multipart upload; upload might be not optimized" name=alertmanager/user-1/fullstate err="unsupported type of io.Reader: io.nopCloserWriterTo"

Introduced in #66 (comment)

Verification

Stepped through a throwaway test:

b := WrapWithMetrics(NewInMemBucket(), prometheus.NewPedanticRegistry(), "a")
b.Upload(context.Background(), "test", bytes.NewReader([]byte{}))

Signed-off-by: Andy Asp <andy.asp@grafana.com>
@andyasp andyasp marked this pull request as ready for review September 20, 2023 17:39
Signed-off-by: Andy Asp <andy.asp@grafana.com>
@yeya24 yeya24 merged commit cac7ba2 into thanos-io:main Sep 21, 2023
7 checks passed
@andyasp andyasp deleted the fix-metricBucket-upload-object-size branch September 21, 2023 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants