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

Side by Side Diff: logdog/client/butler/butler.go

Issue 2601583002: Butler: fix global tags applied to empty map. (Closed)
Patch Set: Added tests, testing method to Bundler. Created 3 years, 12 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 | « logdog/client/butler/bundler/stream.go ('k') | logdog/client/butler/butler_test.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 butler 5 package butler
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "io" 10 "io"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 p = p.Clone() 399 p = p.Clone()
400 if p.Timestamp == nil || p.Timestamp.Time().IsZero() { 400 if p.Timestamp == nil || p.Timestamp.Time().IsZero() {
401 p.Timestamp = google.NewTimestamp(clock.Now(b.ctx)) 401 p.Timestamp = google.NewTimestamp(clock.Now(b.ctx))
402 } 402 }
403 if err := p.Validate(); err != nil { 403 if err := p.Validate(); err != nil {
404 return err 404 return err
405 } 405 }
406 406
407 // Build per-stream tag map. 407 // Build per-stream tag map.
408 if l := len(b.c.GlobalTags); l > 0 { 408 if l := len(b.c.GlobalTags); l > 0 {
409 if p.Tags == nil {
410 p.Tags = make(map[string]string, l)
411 }
412
409 for k, v := range b.c.GlobalTags { 413 for k, v := range b.c.GlobalTags {
410 // Add only global flags that aren't already present (ov erridden) in 414 // Add only global flags that aren't already present (ov erridden) in
411 // stream tags. 415 // stream tags.
412 if _, ok := p.Tags[k]; !ok { 416 if _, ok := p.Tags[k]; !ok {
413 p.Tags[k] = v 417 p.Tags[k] = v
414 } 418 }
415 } 419 }
416 } 420 }
417 421
418 if p.Timeout > 0 { 422 if p.Timeout > 0 {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // shutdown prematurely, so this should be reasonably quick. 662 // shutdown prematurely, so this should be reasonably quick.
659 b.Activate() 663 b.Activate()
660 } 664 }
661 665
662 // Returns the configured Butler error. 666 // Returns the configured Butler error.
663 func (b *Butler) getRunErr() error { 667 func (b *Butler) getRunErr() error {
664 b.shutdownMu.Lock() 668 b.shutdownMu.Lock()
665 defer b.shutdownMu.Unlock() 669 defer b.shutdownMu.Unlock()
666 return b.runErr 670 return b.runErr
667 } 671 }
OLDNEW
« no previous file with comments | « logdog/client/butler/bundler/stream.go ('k') | logdog/client/butler/butler_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698