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

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

Issue 1906023002: LogDog: Add project namespace to Butler/Collector. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-archivist
Patch Set: Rebase? Created 4 years, 8 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 | « client/internal/logdog/butler/bundler/bundler.go ('k') | client/internal/logdog/butler/butler_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/internal/logdog/butler/butler.go
diff --git a/client/internal/logdog/butler/butler.go b/client/internal/logdog/butler/butler.go
index 8b580d85b7a0af3ee36640b416389897e90851fb..8b0684a451f56183d2a0f2ab7153d2473970aba6 100644
--- a/client/internal/logdog/butler/butler.go
+++ b/client/internal/logdog/butler/butler.go
@@ -17,6 +17,7 @@ import (
"github.com/luci/luci-go/client/internal/logdog/butler/streamserver"
"github.com/luci/luci-go/client/logdog/butlerlib/streamproto"
"github.com/luci/luci-go/common/clock"
+ "github.com/luci/luci-go/common/config"
"github.com/luci/luci-go/common/iotools"
"github.com/luci/luci-go/common/logdog/types"
log "github.com/luci/luci-go/common/logging"
@@ -46,8 +47,14 @@ type Config struct {
// OutputWorkers is the number of simultaneous goroutines that will be used
// to output Butler log data. If zero, DefaultOutputWorkers will be used.
OutputWorkers int
+
+ // Project is the project that the log stream will be bound to.
+ Project config.ProjectName
// Prefix is the log stream common prefix value.
Prefix types.StreamName
+ // Secret is the prefix secret that will be used for streams generated by this
+ // Butler.
+ Secret types.PrefixSecret
// BufferLogs, if true, instructs the butler to buffer collected log data
// before sending it to Output.
@@ -71,8 +78,18 @@ func (c *Config) Validate() error {
if c.Output == nil {
return errors.New("butler: an Output must be supplied")
}
+ // TODO(dnj): Empty project should not validate here once projects are
+ // mandatory.
+ if c.Project != "" {
+ if err := c.Project.Validate(); err != nil {
+ return fmt.Errorf("invalid project: %v", err)
+ }
+ }
if err := c.Prefix.Validate(); err != nil {
- return errors.New("butler: invalid Prefix")
+ return fmt.Errorf("invalid prefix: %v", err)
+ }
+ if err := c.Secret.Validate(); err != nil {
+ return fmt.Errorf("invalid secret: %v", err)
}
return nil
}
@@ -135,6 +152,9 @@ func New(ctx context.Context, config Config) (*Butler, error) {
bc := bundler.Config{
Clock: clock.Get(ctx),
+ Project: config.Project,
+ Prefix: config.Prefix,
+ Secret: config.Secret,
MaxBufferedBytes: streamBufferSize,
MaxBundleSize: config.Output.MaxSize(),
}
« no previous file with comments | « client/internal/logdog/butler/bundler/bundler.go ('k') | client/internal/logdog/butler/butler_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698