Skip to content

[WIP] Logging, auditing, warnings, and PingContext failure handling for switch DB#77

Open
ninabauer wants to merge 3 commits intoapp-sre:mainfrom
ninabauer:switchdb2
Open

[WIP] Logging, auditing, warnings, and PingContext failure handling for switch DB#77
ninabauer wants to merge 3 commits intoapp-sre:mainfrom
ninabauer:switchdb2

Conversation

@ninabauer
Copy link
Contributor

  • adds log output when switching db name
  • adds dbname in audit data
  • after OverrideDBName, try a DB.PingContext, if it fails, fall back to its last value.
  • when current db name is different with env DB_NAME, returns a warning saying current db is not the default one in the response json

Result [][]string `json:"result"`
Error string `json:"error"`
Result [][]string `json:"result"`
Warnings []string `json:"warnings,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason to set Warnings as an array? It is a bit weird to have Error as string but Warning as Array.

response := models.DBNameResponse{DBName: dbName}

if dbName != defaultDBName {
warning := "Current database differs from the default"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add dbName and defaultDBName info to the warn msg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants