mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-16 03:49:52 +00:00
refactor: add some more empty report set objects
for efficiency and consistency
This commit is contained in:
@@ -56,11 +56,11 @@ type NodeControls struct {
|
||||
Controls StringSet
|
||||
}
|
||||
|
||||
var emptyNodeControls = NodeControls{Controls: MakeStringSet()}
|
||||
|
||||
// MakeNodeControls makes a new NodeControls
|
||||
func MakeNodeControls() NodeControls {
|
||||
return NodeControls{
|
||||
Controls: MakeStringSet(),
|
||||
}
|
||||
return emptyNodeControls
|
||||
}
|
||||
|
||||
// Copy is a noop, as NodeControls is immutable
|
||||
|
||||
@@ -65,11 +65,13 @@ func MakeSingletonMetric(t time.Time, v float64) Metric {
|
||||
|
||||
}
|
||||
|
||||
var emptyMetric = Metric{}
|
||||
|
||||
// MakeMetric makes a new Metric from unique samples incrementally ordered in
|
||||
// time.
|
||||
func MakeMetric(samples []Sample) Metric {
|
||||
if len(samples) < 1 {
|
||||
return Metric{}
|
||||
return emptyMetric
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user