| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 "context" | 8 "context" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "errors" | 10 "errors" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 fmt.Printf("%s\t%s\n", isolItem.Digest, filepath.Base(archiveOpts.Isolat
ed)) | 254 fmt.Printf("%s\t%s\n", isolItem.Digest, filepath.Base(archiveOpts.Isolat
ed)) |
| 255 | 255 |
| 256 end := time.Now() | 256 end := time.Now() |
| 257 | 257 |
| 258 if endpoint := eventlogEndpoint(c.isolateFlags.EventlogEndpoint); endpoi
nt != "" { | 258 if endpoint := eventlogEndpoint(c.isolateFlags.EventlogEndpoint); endpoi
nt != "" { |
| 259 logger := eventlog.NewClient(ctx, endpoint) | 259 logger := eventlog.NewClient(ctx, endpoint) |
| 260 | 260 |
| 261 // TODO(mcgreevy): fill out more stats in archiveDetails. | 261 // TODO(mcgreevy): fill out more stats in archiveDetails. |
| 262 archiveDetails := &logpb.IsolateClientEvent_ArchiveDetails{ | 262 archiveDetails := &logpb.IsolateClientEvent_ArchiveDetails{ |
| 263 HitCount: proto.Int64(int64(checker.Hit.Count)), |
| 264 MissCount: proto.Int64(int64(checker.Miss.Count)), |
| 265 HitBytes: &checker.Hit.Bytes, |
| 266 MissBytes: &checker.Miss.Bytes, |
| 263 IsolateHash: []string{string(isolItem.Digest)}, | 267 IsolateHash: []string{string(isolItem.Digest)}, |
| 264 } | 268 } |
| 265 if err := logStats(ctx, logger, start, end, archiveDetails); err
!= nil { | 269 if err := logStats(ctx, logger, start, end, archiveDetails); err
!= nil { |
| 266 log.Printf("Failed to log to eventlog: %v", err) | 270 log.Printf("Failed to log to eventlog: %v", err) |
| 267 } | 271 } |
| 268 } | 272 } |
| 269 | 273 |
| 270 return nil | 274 return nil |
| 271 } | 275 } |
| 272 | 276 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 func eventlogEndpoint(endpointFlag string) string { | 336 func eventlogEndpoint(endpointFlag string) string { |
| 333 switch endpointFlag { | 337 switch endpointFlag { |
| 334 case "test": | 338 case "test": |
| 335 return eventlog.TestEndpoint | 339 return eventlog.TestEndpoint |
| 336 case "prod": | 340 case "prod": |
| 337 return eventlog.ProdEndpoint | 341 return eventlog.ProdEndpoint |
| 338 default: | 342 default: |
| 339 return endpointFlag | 343 return endpointFlag |
| 340 } | 344 } |
| 341 } | 345 } |
| OLD | NEW |