Sobes.tech
Senior

Were there many invalid messages? About 10%?

sobes.tech AI

Answer from AI

If we're talking about logging or system monitoring in Go, then 10% invalid messages is a fairly high indicator that warrants analysis.

To assess the number of invalid messages, metrics and logs are usually collected, for example, using middleware that validates incoming data.

If indeed about 10% of messages are invalid, this could indicate:

  • Client-side issues (errors in data or formats).
  • Incorrect validation on the server.
  • Attacks or attempts to send incorrect data.

It is recommended to:

  • Improve validation and error handling.
  • Add detailed logging for analysis of causes.
  • Notify the frontend team or clients about data issues if necessary.

An example of simple JSON validation in Go:

var msg Message
err := json.Unmarshal(data, &msg)
if err != nil {
    log.Printf("Invalid message: %v", err)
    // handle error
}
Were there many invalid messages? About 10%? — Golang - sobes.tech