Skip to content

Commit

Permalink
Starter Tracking (#1)
Browse files Browse the repository at this point in the history
* starterCounter?

* Update api/savedata/update.go

---------

Co-authored-by: frutescens <info@laptop>
Co-authored-by: Frederico Santos <[email protected]>
  • Loading branch information
3 people authored Nov 5, 2024
1 parent 3048e22 commit 2f9ed3a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/savedata/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ var (
},
[]string{"gamemode"},
)

starterCounter = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "rogueserver_starter_count",
Help: "The total number of times a specific starter was selected",
},
[]string{"starterKey"},
)
)
11 changes: 11 additions & 0 deletions api/savedata/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,15 @@ func ProcessSessionMetrics(save defs.SessionSaveData, uuid []byte) {
case 4:
gameModeCounter.WithLabelValues("challenge").Inc()
}
if save.WaveIndex == 1 {
for i := 0; i < len(save.Party); i++ {
formIndex = ""

Check failure on line 84 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: formIndex

Check failure on line 84 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: formIndex

Check failure on line 84 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

undefined: formIndex
if save.Party[i]["formIndex"] != 0 {

Check failure on line 85 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)

Check failure on line 85 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)

Check failure on line 85 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)
formIndex = "-"+save.Party[i]["formIndex"]

Check failure on line 86 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: formIndex

Check failure on line 86 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)

Check failure on line 86 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: formIndex

Check failure on line 86 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)

Check failure on line 86 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

undefined: formIndex

Check failure on line 86 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)
}
key = save.Party[i]["Species"] + formIndex

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: key

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: formIndex

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: key

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: formIndex

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

undefined: key

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

invalid operation: cannot index save.Party[i] (variable of type defs.PokemonData)

Check failure on line 88 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

undefined: formIndex
log.Printf("incremented starter %s", key)

Check failure on line 89 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: key

Check failure on line 89 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: key

Check failure on line 89 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

undefined: key
starterCounter.WithLabelValues(key).Inc()

Check failure on line 90 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: key (typecheck)

Check failure on line 90 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (linux)

undefined: key

Check failure on line 90 in api/savedata/update.go

View workflow job for this annotation

GitHub Actions / Build (windows)

undefined: key
}
}
}

0 comments on commit 2f9ed3a

Please sign in to comment.