lib/gobuild: fix swapped put_s3_object and put_s3_found metrics - #26
Closed
RaphaelFakhri wants to merge 1 commit into
Closed
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
PutCond reports true when it wrote the object, but maybePutObject counted that case as an object that was already present, and the reverse. Count written objects in put_s3_object and pre-existing ones in put_s3_found. Fixes #25 Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
maybePutObjectincrementedput_s3_foundwhenPutCondreported that it wrote the object, andput_s3_objectwhen it did not. The counters were reversed.This change increments
put_s3_objectfor uploaded objects andput_s3_foundfor objects that were already present.Testing
TestPutMetricsrunsS3Cache.Putagainst an in-memory S3 endpoint. It writes a new object and checks thatput_s3_objectis 1 andput_s3_foundis 0. It then writes a second action for the same output and checks thatput_s3_foundis 1.Before the change, the test fails on the first check. After the change, it passes.
go vetandgofmt -lreport nothing.Fixes #25