Uploaded image for project: 'Hybrid Cloud Console'
  1. Hybrid Cloud Console
  2. RHCLOUD-35739

Make status codes recorded consistent

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Unset
    • None

      Raj observed the prometheus logs use HTTP error codes for any failures irrespective of whether they were HTTP or gRPC requests. Error logs also always record HTTP error codes. Successes, however, are always recorded as gRPC OK (0)

      Internally, Kratos models all errors as HTTP and can then convert to gRPC as-needed (ex: to set the status code on a response sent to the client), but builtin middleware don't do this- they don't know the protocol that was used to send the request and appear to log properties directly from the error object (example, example) which are always HTTP-based. Success coming through as gRPC OK appears to be coincidental- the code path that populates that field is only hit when there's an error, so successes have an empty/0 value.

      It's possible the use of HTTP status codes for both protocols is intended - it abstracts the protocol used, and they're more widely recognized, more likely to be compatible with existing dashboards, etc, and since the gRPC codes are derived from HTTP anyway, showing them wouldn't provide any additional information - but OK is inconsistent. Plus, our API is primarily gRPC, and seeing HTTP status codes in the logs was unexpected (though whether this is purely a documentation issue is a separate question.)

              Unassigned Unassigned
              wscalf@redhat.com William Scalf
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: