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

Unified Diff: client/cmd/logdog_annotee/main.go

Issue 1916813002: Annotee: Add project name support. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-collector-butler
Patch Set: Better URL generation. 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/cmd/logdog_annotee/link.go ('k') | client/logdog/annotee/processor.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cmd/logdog_annotee/main.go
diff --git a/client/cmd/logdog_annotee/main.go b/client/cmd/logdog_annotee/main.go
index d6602632274e9315e044fb4a883c10bf6b36e0b5..10fc4f9b2b503ca3efd16d163fb6e85ecc6c50b9 100644
--- a/client/cmd/logdog_annotee/main.go
+++ b/client/cmd/logdog_annotee/main.go
@@ -19,6 +19,7 @@ import (
"github.com/luci/luci-go/client/logdog/butlerlib/streamclient"
"github.com/luci/luci-go/client/logdog/butlerlib/streamproto"
"github.com/luci/luci-go/common/clock/clockflag"
+ "github.com/luci/luci-go/common/config"
"github.com/luci/luci-go/common/logdog/types"
log "github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/logging/gologger"
@@ -57,6 +58,7 @@ type application struct {
printSummary bool
testingDir string
annotationInterval clockflag.Duration
+ project config.ProjectName
nameBase streamproto.StreamNameFlag
prefix streamproto.StreamNameFlag
logdogHost string
@@ -82,6 +84,7 @@ func (a *application) addToFlagSet(fs *flag.FlagSet) {
"and streams to this directory.")
fs.Var(&a.annotationInterval, "annotation-interval",
"Buffer annotation updates for this amount of time. <=0 sends every update.")
+ fs.Var(&a.project, "project", "The log prefix's project name (required).")
fs.Var(&a.nameBase, "name-base", "Base stream name to prepend to generated names.")
fs.Var(&a.prefix, "prefix", "The log stream prefix. If missing, one will be inferred from bootstrap.")
fs.StringVar(&a.logdogHost, "logdog-host", "",
@@ -158,6 +161,11 @@ func mainImpl(args []string) int {
prefix = a.bootstrap.Prefix
}
+ // TODO(dnj): Require project attribute.
+ if a.project == "" {
+ a.project = a.bootstrap.Project
+ }
+
args = fs.Args()
if a.jsonArgsPath != "" {
if len(args) > 0 {
@@ -188,13 +196,21 @@ func mainImpl(args []string) int {
a.annotationInterval = 0
}
+ // Initialize our link generator, if we can.
+ linkGen := &coordinatorLinkGenerator{
+ base: types.StreamName(a.nameBase),
+ project: a.project,
+ prefix: prefix,
+ }
+ if !linkGen.canGenerateLinks() {
+ linkGen = nil
+ }
+
e := executor.Executor{
Options: annotee.Options{
- Base: types.StreamName(a.nameBase),
- Prefix: prefix,
Client: client,
+ LinkGenerator: linkGen,
MetadataUpdateInterval: time.Duration(a.annotationInterval),
- LogDogHost: a.logdogHost,
},
Annotate: executor.AnnotationMode(a.annotate),
« no previous file with comments | « client/cmd/logdog_annotee/link.go ('k') | client/logdog/annotee/processor.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698