• Oran Agra's avatar
    Fix error stats and failed command stats for blocked clients (#10309) · fad0b0d2
    Oran Agra authored
    This is a followup work for #10278, and a discussion about #10279
    
    The changes:
    - fix failed_calls in command stats for blocked clients that got error.
      including CLIENT UNBLOCK, and module replying an error from a thread.
    - fix latency stats for XREADGROUP that filed with -NOGROUP
    
    Theory behind which errors should be counted:
    - error stats represents errors returned to the user, so an error handled by a
      module should not be counted.
    - total error counter should be the same.
    - command stats represents execution of commands (even with RM_Call, and if
      they fail or get rejected it counts these calls in commandstats, so it should
      also count failed_calls)
    
    Some thoughts about Scripts:
    for scripts it could be different since they're part of user code, not the infra (not an extension to redis)
    we certainly want commandstats to contain all calls and errors
    a simple script is like mult-exec transaction so an error inside it should be counted in error stats
    a script that replies with an error to the user (using redis.error_reply) should also be counted in error stats
    but then the problem is that a plain `return redis.call("SET")` should not be counted twice (once for the SET
    and once for EVAL)
    so that's something left to be resolved in #10279
    fad0b0d2
blockedclient.tcl 7.41 KB