Add flag for querier to talk to collectors

This commit is contained in:
Bryan Boreham
2021-03-28 13:59:25 +01:00
parent 1eb57c2e40
commit b9c8cf6998
3 changed files with 7 additions and 3 deletions

View File

@@ -142,6 +142,7 @@ type AWSCollectorConfig struct {
MemcacheClient *MemcacheClient
Window time.Duration
MaxTopNodes int
CollectorAddr string
}
// if StoreInterval is set, reports are merged into here and held until flushed to store

View File

@@ -90,7 +90,7 @@ func router(collector app.Collector, controlRouter app.ControlRouter, pipeRouter
}
func collectorFactory(userIDer multitenant.UserIDer, collectorURL, s3URL string, storeInterval time.Duration, natsHostname string,
memcacheConfig multitenant.MemcacheConfig, window time.Duration, maxTopNodes int, createTables bool) (app.Collector, error) {
memcacheConfig multitenant.MemcacheConfig, window time.Duration, maxTopNodes int, createTables bool, collectorAddr string) (app.Collector, error) {
if collectorURL == "local" {
return app.NewCollector(window), nil
}
@@ -134,6 +134,7 @@ func collectorFactory(userIDer multitenant.UserIDer, collectorURL, s3URL string,
MemcacheClient: memcacheClient,
Window: window,
MaxTopNodes: maxTopNodes,
CollectorAddr: collectorAddr,
},
)
if err != nil {
@@ -248,7 +249,7 @@ func appMain(flags appFlags) {
Service: flags.memcachedService,
CompressionLevel: flags.memcachedCompressionLevel,
},
flags.window, flags.maxTopNodes, flags.awsCreateTables)
flags.window, flags.maxTopNodes, flags.awsCreateTables, flags.collectorAddr)
if err != nil {
log.Fatalf("Error creating collector: %v", err)
return

View File

@@ -162,7 +162,8 @@ type appFlags struct {
containerName string
dockerEndpoint string
collectorURL string
collectorURL string // how collector talks to backing store (or "local" if none)
collectorAddr string // how to find collectors if deployed as microservices
s3URL string
storeInterval time.Duration
controlRouterURL string
@@ -376,6 +377,7 @@ func setupFlags(flags *flags) {
flag.Var(&flags.containerLabelFilterFlagsExclude, "app.container-label-filter-exclude", "Add container label-based view filter that excludes containers with the given label, specified as title:label. Multiple flags are accepted. Example: --app.container-label-filter-exclude='Database Containers:role=db'")
flag.StringVar(&flags.app.collectorURL, "app.collector", "local", "Collector to use (local, dynamodb, or file/directory)")
flag.StringVar(&flags.app.collectorAddr, "app.collector-addr", "", "Address to look up collectors when deployed as microservices")
flag.StringVar(&flags.app.s3URL, "app.collector.s3", "local", "S3 URL to use (when collector is dynamodb)")
flag.DurationVar(&flags.app.storeInterval, "app.collector.store-interval", 0, "How often to store merged incoming reports. If 0, reports are stored unmerged as they arrive.")
flag.StringVar(&flags.app.controlRouterURL, "app.control.router", "local", "Control router to use (local or sqs)")