-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmetric.go
53 lines (46 loc) · 1.82 KB
/
metric.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package stream
// Every metric satisfies one of the following interfaces below.
// Metric is the interface for a metric that consumes from a stream.
// Metric is the standard interface for most metrics; in particular
// for those that consume single numeric values at a time. There is no
// Value method for this interface, allowing implementations to roll
// custom value methods.
type Metric interface {
Push(float64) error
String() string
Clear()
}
// SimpleMetric is the interface for a Metric that returns a singular value.
type SimpleMetric interface {
Metric
Value() (float64, error)
}
// AggregateMetric is the interface for a metric that tracks multiple univariate single-value metrics simultaneously.
// Values() returns a map of metrics to their corresponding values at that given
// time. The keys are the string representations of the metrics (by calling the String() method).
type AggregateMetric interface {
Push(float64) error
Values() (map[string]interface{}, error)
Clear()
}
// JointMetric is the interface for a metric that tracks joint statistics from a stream.
// There is no Value method for this interface, allowing implementations to roll
// custom value methods.
type JointMetric interface {
Push(...float64) error
String() string
Clear()
}
// SimpleJointMetric is the interface for a JointMetric that returns a singular value.
type SimpleJointMetric interface {
JointMetric
Value() (float64, error)
}
// JointAggregateMetric is the interface for a metric that tracks multiple multivariate single-value metrics simultaneously.
// Values() returns a map of metrics to their corresponding values at that given
// time. The keys are the string representations of the metrics (by calling the String() method).
type JointAggregateMetric interface {
Push(...float64) error
Values() (map[string]interface{}, error)
Clear()
}