@@ -86,6 +86,7 @@ type Cache struct {
86
86
putS3Found expvar.Int // count of objects not written to S3 because they were already present
87
87
putS3Action expvar.Int // count of actions written to S3
88
88
putS3Object expvar.Int // count of objects written to S3
89
+ putS3Error expvar.Int // count of errors writing to S3
89
90
}
90
91
91
92
func (s * Cache ) init () {
@@ -200,9 +201,8 @@ func (s *Cache) Close(ctx context.Context) error {
200
201
if s .push != nil {
201
202
gocache .Logf (ctx , "waiting for uploads..." )
202
203
wstart := time .Now ()
203
- err := s .push .Wait ()
204
- gocache .Logf (ctx , "uploads complete (%v elapsed, err=%v)" ,
205
- time .Since (wstart ).Round (10 * time .Microsecond ), err )
204
+ s .push .Wait ()
205
+ gocache .Logf (ctx , "uploads complete (%v elapsed)" , time .Since (wstart ).Round (10 * time .Microsecond ))
206
206
}
207
207
return nil
208
208
}
@@ -216,6 +216,7 @@ func (s *Cache) SetMetrics(_ context.Context, m *expvar.Map) {
216
216
m .Set ("put_s3_found" , & s .putS3Found )
217
217
m .Set ("put_s3_action" , & s .putS3Action )
218
218
m .Set ("put_s3_object" , & s .putS3Object )
219
+ m .Set ("put_s3_error" , & s .putS3Error )
219
220
}
220
221
221
222
// maybePutObject writes the specified object contents to S3 if there is not
@@ -248,6 +249,7 @@ func (s *Cache) maybePutObject(ctx context.Context, objectID, diskPath, etag str
248
249
Key : s .objectKey (objectID ),
249
250
Body : f ,
250
251
}); err != nil {
252
+ s .putS3Error .Add (1 )
251
253
gocache .Logf (ctx , "[s3] put object %s: %v" , objectID , err )
252
254
return fi .ModTime (), err
253
255
}
0 commit comments