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

Side by Side Diff: client/cmd/isolate/exp_archive.go

Issue 2557593002: Add batch logging support to eventlog. (Closed)
Patch Set: Fix race in test. Created 4 years 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
« no previous file with comments | « no previous file | common/eventlog/eventlog.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if err := ioutil.WriteFile(archiveOpts.Isolated, isolJSON, 0644); err != nil { 211 if err := ioutil.WriteFile(archiveOpts.Isolated, isolJSON, 0644); err != nil {
212 return err 212 return err
213 } 213 }
214 isolatedHash := string(isolated.HashBytes(isolJSON)) 214 isolatedHash := string(isolated.HashBytes(isolJSON))
215 fmt.Printf("%s\t%s\n", isolatedHash, filepath.Base(archiveOpts.Isolated) ) 215 fmt.Printf("%s\t%s\n", isolatedHash, filepath.Base(archiveOpts.Isolated) )
216 216
217 end := time.Now() 217 end := time.Now()
218 218
219 if endpoint := eventlogEndpoint(c.isolateFlags.EventlogEndpoint); endpoi nt != "" { 219 if endpoint := eventlogEndpoint(c.isolateFlags.EventlogEndpoint); endpoi nt != "" {
220 ctx := context.Background() 220 ctx := context.Background()
221 » » logger := eventlog.NewClient(endpoint) 221 » » logger := eventlog.NewClient(ctx, endpoint)
222 222
223 // TODO(mcgreevy): fill out more stats in archiveDetails. 223 // TODO(mcgreevy): fill out more stats in archiveDetails.
224 archiveDetails := &logpb.IsolateClientEvent_ArchiveDetails{ 224 archiveDetails := &logpb.IsolateClientEvent_ArchiveDetails{
225 IsolateHash: []string{isolatedHash}, 225 IsolateHash: []string{isolatedHash},
226 } 226 }
227 if err := logStats(ctx, logger, start, end, archiveDetails); err != nil { 227 if err := logStats(ctx, logger, start, end, archiveDetails); err != nil {
228 log.Printf("Failed to log to eventlog: %v", err) 228 log.Printf("Failed to log to eventlog: %v", err)
229 } 229 }
230 } 230 }
231 231
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 func eventlogEndpoint(endpointFlag string) string { 294 func eventlogEndpoint(endpointFlag string) string {
295 switch endpointFlag { 295 switch endpointFlag {
296 case "test": 296 case "test":
297 return eventlog.TestEndpoint 297 return eventlog.TestEndpoint
298 case "prod": 298 case "prod":
299 return eventlog.ProdEndpoint 299 return eventlog.ProdEndpoint
300 default: 300 default:
301 return endpointFlag 301 return endpointFlag
302 } 302 }
303 } 303 }
OLDNEW
« no previous file with comments | « no previous file | common/eventlog/eventlog.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698