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

Unified Diff: logdog/client/butler/butler.go

Issue 2456953003: LogDog: Update client/bootstrap to generate URLs. (Closed)
Patch Set: Winders Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « logdog/client/butler/bundler/bundler.go ('k') | logdog/client/butler/butler_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/client/butler/butler.go
diff --git a/logdog/client/butler/butler.go b/logdog/client/butler/butler.go
index 1cb7ab8e4a579e4239e1e650d73f2dc87aa673b0..294016b35fc918e2b75f6991c65b4a16d4e16a21 100644
--- a/logdog/client/butler/butler.go
+++ b/logdog/client/butler/butler.go
@@ -313,7 +313,7 @@ func (b *Butler) AddStreamServer(streamServer streamserver.StreamServer) {
// Add this Stream to the Butler.
//
// We run this in a function so we can ensure cleanup on failure.
- if err := b.AddStream(rc, *config); err != nil {
+ if err := b.AddStream(rc, config); err != nil {
log.Fields{
log.ErrorKey: err,
}.Errorf(ctx, "Failed to add stream.")
@@ -347,7 +347,8 @@ func (b *Butler) AddStreamServer(streamServer streamserver.StreamServer) {
//
// If an error is occurred, the caller is still the owner of the stream and
// is responsible for closing it.
-func (b *Butler) AddStream(rc io.ReadCloser, p streamproto.Properties) error {
+func (b *Butler) AddStream(rc io.ReadCloser, p *streamproto.Properties) error {
+ p = p.Clone()
if p.Timestamp == nil || p.Timestamp.Time().IsZero() {
p.Timestamp = google.NewTimestamp(clock.Now(b.ctx))
}
@@ -393,18 +394,21 @@ func (b *Butler) AddStream(rc io.ReadCloser, p streamproto.Properties) error {
return fmt.Errorf("invalid tee value: %v", p.Tee)
}
- p.Prefix = string(b.c.Prefix)
if err := b.registerStream(p.Name); err != nil {
return err
}
+ // Register this stream with our Bundler. It will take ownership of "p", so
+ // we should not use it after this point.
+ streamCtx := log.SetField(b.ctx, "stream", p.Name)
bs, err := b.bundler.Register(p)
if err != nil {
return err
}
+ p = nil
b.streamC <- &stream{
- Context: log.SetField(b.ctx, "stream", p.Name),
+ Context: streamCtx,
r: reader,
c: rc,
bs: bs,
« no previous file with comments | « logdog/client/butler/bundler/bundler.go ('k') | logdog/client/butler/butler_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698