Chromium Code Reviews| Index: logdog/client/butler/butler.go |
| diff --git a/logdog/client/butler/butler.go b/logdog/client/butler/butler.go |
| index 80b0d04cf94be17b921e34e2b8811c5a6f89f7b5..c75653e93d179b626b98ec1ce6d1fe7d81e7b0c3 100644 |
| --- a/logdog/client/butler/butler.go |
| +++ b/logdog/client/butler/butler.go |
| @@ -25,6 +25,7 @@ import ( |
| "github.com/luci/luci-go/logdog/client/butler/streamserver" |
| "github.com/luci/luci-go/logdog/client/butlerlib/streamproto" |
| "github.com/luci/luci-go/logdog/common/types" |
| + |
| "golang.org/x/net/context" |
| ) |
| @@ -56,6 +57,11 @@ type Config struct { |
| // Prefix is the log stream common prefix value. |
| Prefix types.StreamName |
| + // GlobalTags are a set of global log stream tags to apply to individual |
| + // streams on registration. Individual stream tags will override tags with |
| + // the same key. |
| + GlobalTags streamproto.TagMap |
| + |
| // BufferLogs, if true, instructs the butler to buffer collected log data |
| // before sending it to Output. |
| BufferLogs bool |
| @@ -398,6 +404,18 @@ func (b *Butler) AddStream(rc io.ReadCloser, p *streamproto.Properties) error { |
| return err |
| } |
| + // Build per-stream tag map. |
| + if l := len(b.c.GlobalTags); l > 0 { |
| + streamTags := make(map[string]string, l+len(p.Tags)) |
|
seanmccullough1
2016/12/22 01:46:10
why not just assign to/mutate p.Tags?
dnj
2016/12/22 01:49:38
Hmm good point, will do that.
|
| + for k, v := range b.c.GlobalTags { |
| + streamTags[k] = v |
| + } |
| + for k, v := range p.Tags { |
| + streamTags[k] = v |
| + } |
| + p.Tags = streamTags |
| + } |
| + |
| if p.Timeout > 0 { |
| if rts, ok := rc.(iotools.ReadTimeoutSetter); ok { |
| if err := rts.SetReadTimeout(p.Timeout); err != nil { |