This commit is contained in:
Zheng Kai
2023-06-16 14:59:16 +08:00
parent ba6e6f047c
commit 05fe88de8b
9 changed files with 256 additions and 7 deletions

View File

@@ -15,18 +15,22 @@ import (
//go:embed tpl/mapping.json
var indexMapping string
func indexName(ts uint32) string {
func indexNameBase() string {
index := `orca-metrics`
if !config.Prod {
index = `dev-` + index
}
index = fmt.Sprintf(`%s-%s`, index, time.Unix(int64(ts), 0).Format(`2006.01.02`))
return index
}
func indexName(ts uint32) string {
return fmt.Sprintf(`%s-%s`, indexNameBase(), time.Unix(int64(ts), 0).Format(`2006.01.02`))
}
func indexNameAll() string {
return indexNameBase() + `-*`
}
func createIndex() {
ts := zu.TS()