prom.go 622 B

1234567891011121314151617181920212223242526272829
  1. package prom
  2. import (
  3. "fmt"
  4. )
  5. const (
  6. RouteNormalMode = "normal_mode"
  7. RouteCodeMode = "code_mode"
  8. RouteUpFrom = "upfrom_"
  9. RouteNumFormatVids = "%s_%dp"
  10. RouteStrFormatVids = "%s_%sp"
  11. RouteDmIndexTry = "dm_index_retry"
  12. RouteDatabusTry = "databus_retry"
  13. )
  14. // FormatVideoKey format videos prom key
  15. func FormatVideoKey(count int, tp string) (key string) {
  16. if count >= 0 && count <= 5 {
  17. key = fmt.Sprintf(RouteNumFormatVids, tp, count)
  18. } else if count >= 6 && count <= 10 {
  19. key = fmt.Sprintf(RouteStrFormatVids, tp, "6_10")
  20. } else {
  21. key = fmt.Sprintf(RouteStrFormatVids, tp, "above_10")
  22. }
  23. return
  24. }