[Feature] Two Separate Counters for Endless and Classic Starter Choice (#2)

* Revert "Remove Daily from starter tracking"

This reverts commit ce4aea88de78696c76046c862cdcae2f5d6d871f.

* Added separate starter counter for Endless/Endless Spliced

* Added daily conditional

* Changed starterCounter to also hold information about the game mode.

---------

Co-authored-by: frutescens <info@laptop>
pull/60/head
Mumble 2 weeks ago committed by GitHub
parent e6d55617df
commit 0da0283fb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,6 +19,6 @@ var (
Name: "rogueserver_starter_count", Name: "rogueserver_starter_count",
Help: "The total number of times a specific starter was selected", Help: "The total number of times a specific starter was selected",
}, },
[]string{"starterKey"}, []string{"starterKey", "gameMode"},
) )
) )

@ -71,18 +71,7 @@ func ProcessSessionMetrics(save defs.SessionSaveData, username string) {
return return
} else { } else {
log.Printf("increased game mode counter for %s", username) log.Printf("increased game mode counter for %s", username)
switch save.GameMode { gameModeCounter.WithLabelValues(getGameModeKey(save.GameMode)).Inc()
case 0:
gameModeCounter.WithLabelValues("classic").Inc()
case 1:
gameModeCounter.WithLabelValues("endless").Inc()
case 2:
gameModeCounter.WithLabelValues("spliced-endless").Inc()
case 3:
gameModeCounter.WithLabelValues("daily").Inc()
case 4:
gameModeCounter.WithLabelValues("challenge").Inc()
}
} }
if save.WaveIndex == 1 && save.GameMode != 3 { if save.WaveIndex == 1 && save.GameMode != 3 {
@ -108,8 +97,25 @@ func ProcessSessionMetrics(save defs.SessionSaveData, username string) {
key := fmt.Sprintf("%d%s", species, formIndex) key := fmt.Sprintf("%d%s", species, formIndex)
party += key + "," party += key + ","
starterCounter.WithLabelValues(key).Inc() starterCounter.WithLabelValues(key, getGameModeKey(save.GameMode)).Inc()
} }
log.Printf("Incremented starters %s count for %s", party, username) log.Printf("Incremented starters %s count for %s", party, username)
} }
} }
func getGameModeKey(gameMode defs.GameMode) string {
switch gameMode {
case 0:
return "classic"
case 1:
return "endless"
case 2:
return "spliced-endless"
case 3:
return "daily"
case 4:
return "challenge"
}
return "none"
}

Loading…
Cancel
Save