Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Side by Side Diff: logdog/server/cmd/logdog_collector/main.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: copyright Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "time" 9 "time"
10 10
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 }.Infof(c, "Received Pub/Sub Message.") 184 }.Infof(c, "Received Pub/Sub Message.")
185 185
186 startTime := clock.Now(c) 186 startTime := clock.Now(c)
187 err := coll.Process(c, msg.Data) 187 err := coll.Process(c, msg.Data)
188 duration := clock.Now(c).Sub(startTime) 188 duration := clock.Now(c).Sub(startTime)
189 189
190 // We track processing time in milliseconds. 190 // We track processing time in milliseconds.
191 tsTaskProcessingTime.Add(c, duration.Seconds()*1000) 191 tsTaskProcessingTime.Add(c, duration.Seconds()*1000)
192 192
193 switch { 193 switch {
194 » case errors.IsTransient(err): 194 » case retry.Tag.In(err):
195 // Do not consume 195 // Do not consume
196 log.Fields{ 196 log.Fields{
197 log.ErrorKey: err, 197 log.ErrorKey: err,
198 "duration": duration, 198 "duration": duration,
199 }.Warningf(c, "TRANSIENT error ingesting Pub/Sub message.") 199 }.Warningf(c, "TRANSIENT error ingesting Pub/Sub message.")
200 tsPubsubCount.Add(c, 1, "transient_failure") 200 tsPubsubCount.Add(c, 1, "transient_failure")
201 return false 201 return false
202 202
203 case err == nil: 203 case err == nil:
204 log.Fields{ 204 log.Fields{
(...skipping 18 matching lines...) Expand all
223 func main() { 223 func main() {
224 mathrand.SeedRandomly() 224 mathrand.SeedRandomly()
225 a := application{ 225 a := application{
226 Service: service.Service{ 226 Service: service.Service{
227 Name: "collector", 227 Name: "collector",
228 DefaultAuthOptions: chromeinfra.DefaultAuthOptions(), 228 DefaultAuthOptions: chromeinfra.DefaultAuthOptions(),
229 }, 229 },
230 } 230 }
231 a.Run(context.Background(), a.runCollector) 231 a.Run(context.Background(), a.runCollector)
232 } 232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698