Skip to content

Commit

Permalink
fix: Enhance session metrics logging to include party member species …
Browse files Browse the repository at this point in the history
…and username
  • Loading branch information
f-fsantos committed Nov 6, 2024
1 parent 28c279c commit 400cb28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/savedata/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func ProcessSessionMetrics(save defs.SessionSaveData, username string) {
}

if save.WaveIndex == 1 {
party := ""
for i := 0; i < len(save.Party); i++ {
partyMember, ok := save.Party[i].(map[string]interface{})
if !ok {
Expand All @@ -98,15 +99,16 @@ func ProcessSessionMetrics(save defs.SessionSaveData, username string) {
formIndex = fmt.Sprintf("%d", formIdx)
}

species, ok := partyMember["Species"].(int)
species, ok := partyMember["species"].(int)
if !ok {
log.Printf("invalid type for Species at index %d", i)
continue
}

key := fmt.Sprintf("%d-%s", species, formIndex)
log.Printf("incremented starter %s", key)
party += key + ","
starterCounter.WithLabelValues(key).Inc()
}
log.Printf("Incremented starters %s count for %s", party, username)
}
}

0 comments on commit 400cb28

Please sign in to comment.