R3: backend rate-limit observability — ratewatch, auto-flag, admin throttled view
- accounts.flagged_high_rate_at baked into the R1 baseline (no prod data; the contour schema is wiped after merge); jet regenerated — the regen also picks up the previously missing game_drafts/game_hidden models. - account.Store: FlagHighRate (set-once), ClearHighRateFlag, the flag in GetByID/ListUsers and a ListFlaggedHighRate review queue. - New internal/ratewatch: ingests the gateway rejection reports, keeps a bounded in-memory episode window for the console and applies the conservative auto-flag (1000 rejected / 10 min, BACKEND_HIGHRATE_FLAG_*). - POST /api/v1/internal/ratelimit/report (network-trusted, like sessions/resolve). - Admin console: Throttled page (episodes + flagged accounts), a high-rate badge in the user list, the marker + operator clear action on the user card. - Tests: ratewatch unit suite, report-route handler test, renderer cases, integration coverage for the store round-trip and the console flow.
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Code generated by go-jet DO NOT EDIT.
|
||||
//
|
||||
// WARNING: Changes to this file may cause incorrect behavior
|
||||
// and will be lost if the code is regenerated
|
||||
//
|
||||
|
||||
package table
|
||||
|
||||
import (
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
var GameHidden = newGameHiddenTable("backend", "game_hidden", "")
|
||||
|
||||
type gameHiddenTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
AccountID postgres.ColumnString
|
||||
GameID postgres.ColumnString
|
||||
CreatedAt postgres.ColumnTimestampz
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
DefaultColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type GameHiddenTable struct {
|
||||
gameHiddenTable
|
||||
|
||||
EXCLUDED gameHiddenTable
|
||||
}
|
||||
|
||||
// AS creates new GameHiddenTable with assigned alias
|
||||
func (a GameHiddenTable) AS(alias string) *GameHiddenTable {
|
||||
return newGameHiddenTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new GameHiddenTable with assigned schema name
|
||||
func (a GameHiddenTable) FromSchema(schemaName string) *GameHiddenTable {
|
||||
return newGameHiddenTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new GameHiddenTable with assigned table prefix
|
||||
func (a GameHiddenTable) WithPrefix(prefix string) *GameHiddenTable {
|
||||
return newGameHiddenTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new GameHiddenTable with assigned table suffix
|
||||
func (a GameHiddenTable) WithSuffix(suffix string) *GameHiddenTable {
|
||||
return newGameHiddenTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newGameHiddenTable(schemaName, tableName, alias string) *GameHiddenTable {
|
||||
return &GameHiddenTable{
|
||||
gameHiddenTable: newGameHiddenTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newGameHiddenTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newGameHiddenTableImpl(schemaName, tableName, alias string) gameHiddenTable {
|
||||
var (
|
||||
AccountIDColumn = postgres.StringColumn("account_id")
|
||||
GameIDColumn = postgres.StringColumn("game_id")
|
||||
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
||||
allColumns = postgres.ColumnList{AccountIDColumn, GameIDColumn, CreatedAtColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
defaultColumns = postgres.ColumnList{CreatedAtColumn}
|
||||
)
|
||||
|
||||
return gameHiddenTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
AccountID: AccountIDColumn,
|
||||
GameID: GameIDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
DefaultColumns: defaultColumns,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user