mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-26 16:52:25 +00:00
obtain historic_reports capability from Reporter
This commit is contained in:
@@ -29,6 +29,7 @@ const reportQuantisationInterval = 3 * time.Second
|
||||
// interface for parts of the app, and several experimental components.
|
||||
type Reporter interface {
|
||||
Report(context.Context, time.Time) (report.Report, error)
|
||||
HasHistoricReports() bool
|
||||
WaitOn(context.Context, chan struct{})
|
||||
UnWait(context.Context, chan struct{})
|
||||
}
|
||||
@@ -139,6 +140,12 @@ func (c *collector) Report(_ context.Context, timestamp time.Time) (report.Repor
|
||||
return rpt, nil
|
||||
}
|
||||
|
||||
// HasHistoricReports indicates whether the collector contains reports
|
||||
// older than now-app.window.
|
||||
func (c *collector) HasHistoricReports() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// remove reports older than the app.window
|
||||
func (c *collector) clean() {
|
||||
var (
|
||||
@@ -195,6 +202,12 @@ func (c StaticCollector) Report(context.Context, time.Time) (report.Report, erro
|
||||
return report.Report(c), nil
|
||||
}
|
||||
|
||||
// HasHistoricReports indicates whether the collector contains reports
|
||||
// older than now-app.window.
|
||||
func (c StaticCollector) HasHistoricReports() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Add adds a report to the collector's internal state. It implements Adder.
|
||||
func (c StaticCollector) Add(context.Context, report.Report, []byte) error { return nil }
|
||||
|
||||
|
||||
@@ -340,6 +340,10 @@ func (c *awsCollector) Report(ctx context.Context, timestamp time.Time) (report.
|
||||
return c.merger.Merge(reports).Upgrade(), nil
|
||||
}
|
||||
|
||||
func (c *awsCollector) HasHistoricReports() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// calculateDynamoKeys generates the row & column keys for Dynamo.
|
||||
func calculateDynamoKeys(userid string, now time.Time) (string, string) {
|
||||
rowKey := fmt.Sprintf("%s-%s", userid, strconv.FormatInt(now.UnixNano()/time.Hour.Nanoseconds(), 10))
|
||||
|
||||
@@ -295,7 +295,7 @@ func appMain(flags appFlags) {
|
||||
}
|
||||
|
||||
capabilities := map[string]bool{
|
||||
xfer.HistoricReportsCapability: flags.s3URL != "local",
|
||||
xfer.HistoricReportsCapability: collector.HasHistoricReports(),
|
||||
}
|
||||
handler := router(collector, controlRouter, pipeRouter, flags.externalUI, capabilities)
|
||||
if flags.logHTTP {
|
||||
|
||||
Reference in New Issue
Block a user