Add a timestamp on each report saying when it was generated

Not currently used in the code, but useful when troubleshooting.
This commit is contained in:
Bryan Boreham
2020-03-06 15:39:06 +00:00
parent a47cf0a2aa
commit 3098267be4
3 changed files with 11 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/armon/go-metrics"
log "github.com/sirupsen/logrus"
"github.com/weaveworks/common/mtime"
"golang.org/x/time/rate"
"github.com/weaveworks/scope/report"
@@ -185,6 +186,7 @@ func (p *Probe) report() report.Report {
}
result := report.MakeReport()
result.TS = mtime.Now()
for i := 0; i < cap(reports); i++ {
result.UnsafeMerge(<-reports)
}

View File

@@ -69,6 +69,7 @@ func TestProbe(t *testing.T) {
node := report.MakeNodeWith("a", map[string]string{"b": "c"})
want.Endpoint.AddNode(node)
want.TS = now
pub := mockPublisher{make(chan report.Report, 10)}