mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Merge pull request #181 from weaveworks/rename-new-report
Rename NewReport -> MakeReport
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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{}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func main() {
|
||||
}
|
||||
defer c.Stop()
|
||||
|
||||
report := report.NewReport()
|
||||
report := report.MakeReport()
|
||||
irq := interrupt()
|
||||
OUTER:
|
||||
for {
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user