32 now32 := int64(time.Now().Unix())
33
34 tests := []th.MultiReturnEvalTestItem{
35 { 36 `groupByTags(metric1.foo.*, "avg", "dc")`,
37 map[parser.MetricRequest][]*types.MetricData{
38 {Metric: "metric1.foo.*", From: 0, Until: 1}: {
38 Err: nil,
39 },
40 },
41 {42 // overflow
43 `applyByNode(metric*.name, 2, "%.transform")`,
44 map[parser.MetricRequest][]*types.MetricData{
21 now32 := int64(time.Now().Unix())
22
23 tests := []th.RewriteTestItem{
24 {25 `applyByNode(test.metric*.name, 1, "%.transform")`,
26 map[parser.MetricRequest][]*types.MetricData{
27 {Metric: "test.metric*.name", From: 0, Until: 1}: {
52 Err: nil,
53 },
54 },
55 {56 `aboveSeries(statsd.timers.metric.rate, 1000, 'rate', 'median')`,
57 map[parser.MetricRequest][]*types.MetricData{
58 {Metric: "statsd.timers.metric.rate", From: 0, Until: 1}: {
37 Err: nil,
38 },
39 },
40 {41 `aboveSeries(metric1, 7, ".*Ko.ik$", "Bog")`,
42 map[parser.MetricRequest][]*types.MetricData{
43 {Metric: "metric1", From: 0, Until: 1}: {
Composite literals of struct types imported from another package that do not use the field-keyed syntax are fragile because the addition of a new field (even if unexported) to the struct will cause compilation to fail.
For example,
type S struct {
A int
B int
}
func f() {
s := S{1, 2}
}
will cause errors later on, while
type S struct {
A int
B int
}
func f() {
s := S{A: 1, B: 2}
}
will not.