What happened
The put_s3_object metric counts objects that were already in S3, and put_s3_found counts objects that were newly uploaded.
S3Client.PutCond returns written == true when it uploaded the object. maybePutObject in lib/gobuild/gobuild.go treats written == true as "already present and matching" and increments putS3Found. The two counters are reversed.
What you expected
put_s3_object increments when an object is uploaded.
put_s3_found increments when the object was already present and no upload happened.
Reproduce
Write a new object through S3Cache.Put against an empty bucket. put_s3_found becomes 1 and put_s3_object stays 0.
What happened
The
put_s3_objectmetric counts objects that were already in S3, andput_s3_foundcounts objects that were newly uploaded.S3Client.PutCondreturnswritten == truewhen it uploaded the object.maybePutObjectinlib/gobuild/gobuild.gotreatswritten == trueas "already present and matching" and incrementsputS3Found. The two counters are reversed.What you expected
put_s3_objectincrements when an object is uploaded.put_s3_foundincrements when the object was already present and no upload happened.Reproduce
Write a new object through
S3Cache.Putagainst an empty bucket.put_s3_foundbecomes 1 andput_s3_objectstays 0.