-
Notifications
You must be signed in to change notification settings - Fork 0
/
metric.go
39 lines (34 loc) · 1012 Bytes
/
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
package godruid
type MetricType string
type OrderType string
var (
// Metric
NumericMetricType MetricType = "numeric"
DimensionMetricType MetricType = "dimension"
InvertedMetricType MetricType = "inverted"
// Ordering
LexicographicOrder OrderType = "lexicographic"
AlphaNumericOrder OrderType = "alphanumeric"
NumericOrder OrderType = "numeric"
StrlenOrder OrderType = "strlen"
)
type Metric struct {
Type MetricType `json:"type"`
MetricName string `json:"metric,omitempty"`
Ordering OrderType `json:"ordering,omitempty"`
PreviousStop string `json:"previousStop,omitempty"`
// This is another annoying one, probably a custom Marshal
//Metric *Metric `json:"metric,omitempty"`
}
func NewDimensionOrderedMetric(ot OrderType) *Metric {
return &Metric{
Type: DimensionMetricType,
Ordering: ot,
}
}
func NewNumericOrderedMetric(metricName string) *Metric {
return &Metric{
Type: NumericMetricType,
MetricName: metricName,
}
}