-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_template.txt
38 lines (35 loc) · 1.18 KB
/
test_template.txt
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
package main
import (
"time"
"github.com/vkcom/statshouse-go"
)
func main() {
c := statshouse.NewClientEx(statshouse.ConfigureArgs{StatsHouseAddr: statshouse.DefaultAddr, Network: "tcp"})
defer c.Close()
var t statshouse.NamedTags
for i := 0; i < {{.NumberOfIterations}}; i++ {
{{- range $v := .Metrics }}
t = statshouse.NamedTags{
{{- range $i, $v := $v.Tags -}}
{{ if $i }}, {{ end }}{"{{ index $v 0 }}", "{{ index $v 1 }}"}
{{- end -}}
}
{{- if eq $v.Kind 2 }}
c.NamedUniquesHistoric("{{ $v.Name }}", t, []int64{
{{- range $i, $v := $v.Uniques -}}
{{ if $i }}, {{ end }}{{ $v }}
{{- end -}}
}, {{ $v.Timestamp }})
{{- else if eq $v.Kind 1 }}
c.NamedValuesHistoric("{{ $v.Name }}", t, []float64{
{{- range $i, $v := $v.Values -}}
{{ if $i }}, {{ end }}{{ $v }}
{{- end -}}
}, {{ $v.Timestamp }})
{{- else }}
c.NamedCountHistoric("{{ $v.Name }}", t, {{ printf "%.1f" $v.Count }}, {{ $v.Timestamp }})
{{- end }}
time.Sleep(time.Millisecond)
{{- end }}
}
}