fix: Enhance session metrics logging to include party member species and username

pull/60/head
Frederico Santos 3 weeks ago
parent 28c279c36d
commit 400cb28ee3

@ -86,6 +86,7 @@ func ProcessSessionMetrics(save defs.SessionSaveData, username string) {
} }
if save.WaveIndex == 1 { if save.WaveIndex == 1 {
party := ""
for i := 0; i < len(save.Party); i++ { for i := 0; i < len(save.Party); i++ {
partyMember, ok := save.Party[i].(map[string]interface{}) partyMember, ok := save.Party[i].(map[string]interface{})
if !ok { if !ok {
@ -98,15 +99,16 @@ func ProcessSessionMetrics(save defs.SessionSaveData, username string) {
formIndex = fmt.Sprintf("%d", formIdx) formIndex = fmt.Sprintf("%d", formIdx)
} }
species, ok := partyMember["Species"].(int) species, ok := partyMember["species"].(int)
if !ok { if !ok {
log.Printf("invalid type for Species at index %d", i) log.Printf("invalid type for Species at index %d", i)
continue continue
} }
key := fmt.Sprintf("%d-%s", species, formIndex) key := fmt.Sprintf("%d-%s", species, formIndex)
log.Printf("incremented starter %s", key) party += key + ","
starterCounter.WithLabelValues(key).Inc() starterCounter.WithLabelValues(key).Inc()
} }
log.Printf("Incremented starters %s count for %s", party, username)
} }
} }

Loading…
Cancel
Save