Merge pull request #181 from weaveworks/rename-new-report

Rename NewReport -> MakeReport
This commit is contained in:
Tom Wilkie
2015-06-05 15:46:17 +01:00
10 changed files with 14 additions and 14 deletions

View File

@@ -51,7 +51,7 @@ func NewReportLIFO(r reporter, maxAge time.Duration) *ReportLIFO {
case req := <-l.requests:
// Request for the current report.
report := report.NewReport()
report := report.MakeReport()
for _, r := range l.reports {
report.Merge(r.Report)
}

View File

@@ -15,7 +15,7 @@ func init() {
// DemoReport makes up a report.
func DemoReport(nodeCount int) report.Report {
r := report.NewReport()
r := report.MakeReport()
// Make up some plausible IPv4 numbers
hosts := []string{}

View File

@@ -15,7 +15,7 @@ func init() {
// DemoReport makes up a report.
func DemoReport(nodeCount int) report.Report {
r := report.NewReport()
r := report.MakeReport()
// Make up some plausible IPv4 numbers
hosts := []string{}

View File

@@ -50,7 +50,7 @@ func NewReportLIFO(r reporter, maxAge time.Duration) *ReportLIFO {
l.reports = cleanOld(l.reports, time.Now().Add(-maxAge))
case req := <-l.requests:
report := report.NewReport()
report := report.MakeReport()
for _, r := range l.reports {
report.Merge(r.Report)
}

View File

@@ -34,7 +34,7 @@ func main() {
}
defer c.Stop()
report := report.NewReport()
report := report.MakeReport()
irq := interrupt()
OUTER:
for {

View File

@@ -104,7 +104,7 @@ func main() {
nodeID = hostname // TODO: we should sanitize the hostname
pubTick = time.Tick(*publishInterval)
spyTick = time.Tick(*spyInterval)
r = report.NewReport()
r = report.MakeReport()
)
for {
@@ -113,7 +113,7 @@ func main() {
publishTicks.WithLabelValues().Add(1)
r.HostMetadatas[nodeID] = hostMetadata(hostname)
publisher.Publish(r)
r = report.NewReport()
r = report.MakeReport()
case <-spyTick:
r.Merge(spy(hostname, hostname, *spyProcs, pms))

View File

@@ -24,7 +24,7 @@ func spy(
spyDuration.WithLabelValues().Observe(float64(time.Since(begin)))
}(time.Now())
r := report.NewReport()
r := report.MakeReport()
conns, err := procspy.Connections(includeProcesses)
if err != nil {

View File

@@ -77,8 +77,8 @@ type Row struct {
ValueMinor string `json:"value_minor,omitempty"` // e.g. KB/s
}
// NewReport makes a clean report, ready to Merge() other reports into.
func NewReport() Report {
// MakeReport makes a clean report, ready to Merge() other reports into.
func MakeReport() Report {
return Report{
Process: NewTopology(),
// Transport Topology

View File

@@ -62,7 +62,7 @@ func NewCollector(batchTime time.Duration) Collector {
func (c *realCollector) loop(batchTime time.Duration) {
var (
tick = tick(batchTime)
current = report.NewReport()
current = report.MakeReport()
addrs = map[string]chan struct{}{}
wg = &sync.WaitGroup{} // per-address goroutines
)
@@ -92,7 +92,7 @@ func (c *realCollector) loop(batchTime time.Duration) {
select {
case <-tick:
c.out <- current
current = report.NewReport()
current = report.MakeReport()
case pc := <-c.peekc:
pc <- current

View File

@@ -38,12 +38,12 @@ func TestMerge(t *testing.T) {
time.Sleep(batchTime / 10) // connect
{
r := report.NewReport()
r := report.MakeReport()
r.HostMetadatas["p1"] = report.HostMetadata{Hostname: "test1"}
p1.Publish(r)
}
{
r := report.NewReport()
r := report.MakeReport()
r.HostMetadatas["p2"] = report.HostMetadata{Hostname: "test2"}
p2.Publish(r)
}