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

Side by Side Diff: go/src/infra/tools/kitchen/cook_logdog.go

Issue 2174103002: Kitchen: always emit annotations if teeing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « go/src/infra/tools/kitchen/cook.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "flag" 8 "flag"
9 "fmt" 9 "fmt"
10 "io" 10 "io"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 &p.serviceAccountJSONPath, 84 &p.serviceAccountJSONPath,
85 "logdog-service-account-json-path", 85 "logdog-service-account-json-path",
86 "", 86 "",
87 "If specified, use the service account JSON file at this path. O therwise, autodetect.") 87 "If specified, use the service account JSON file at this path. O therwise, autodetect.")
88 } 88 }
89 89
90 func (p *cookLogDogParams) active() bool { 90 func (p *cookLogDogParams) active() bool {
91 return p.host != "" || p.project != "" || p.prefix != "" 91 return p.host != "" || p.project != "" || p.prefix != ""
92 } 92 }
93 93
94 // emitAnnotations returns true if the cook command should emit additional
95 // annotations.
96 //
97 // If we're streaming solely to LogDog, it makes no sense to emit extra
98 // annotations, since nothing will consume them; however, if we're tee-ing, we
99 // will continue to emit additional annotations in case something is looking
100 // at the tee'd output.
101 //
102 // Note that this could create an incongruity between the LogDog-emitted
103 // annotations and the annotations in the STDOUT stream.
104 func (p *cookLogDogParams) emitAnnotations() bool {
105 return p.tee || !p.active()
106 }
107
94 func (p *cookLogDogParams) validate() error { 108 func (p *cookLogDogParams) validate() error {
95 if p.project == "" { 109 if p.project == "" {
96 return fmt.Errorf("a LogDog project must be supplied (-logdog-pr oject)") 110 return fmt.Errorf("a LogDog project must be supplied (-logdog-pr oject)")
97 } 111 }
98 return nil 112 return nil
99 } 113 }
100 114
101 func (p *cookLogDogParams) getPrefix(env environ.Env) (types.StreamName, error) { 115 func (p *cookLogDogParams) getPrefix(env environ.Env) (types.StreamName, error) {
102 if p.prefix != "" { 116 if p.prefix != "" {
103 return p.prefix, nil 117 return p.prefix, nil
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // callbackReadCloser invokes a callback method when closed. 419 // callbackReadCloser invokes a callback method when closed.
406 type callbackReadCloser struct { 420 type callbackReadCloser struct {
407 io.ReadCloser 421 io.ReadCloser
408 callback func() 422 callback func()
409 } 423 }
410 424
411 func (c *callbackReadCloser) Close() error { 425 func (c *callbackReadCloser) Close() error {
412 defer c.callback() 426 defer c.callback()
413 return c.ReadCloser.Close() 427 return c.ReadCloser.Close()
414 } 428 }
OLDNEW
« no previous file with comments | « go/src/infra/tools/kitchen/cook.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698