Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-30314

Serialisation error in DoHTTPProbe function logging at verbosity level 4 in probehttp.go

XMLWordPrintable

    • Low
    • No
    • 1
    • Sprint 250
    • 1
    • Rejected
    • False
    • Hide

      None

      Show
      None

      In the `DoHTTPProbe` function located at `github.com/openshift/router/pkg/router/metrics/probehttp/probehttp.go`, logging of the HTTP response object at verbosity level 4 results in a serialisation error due to non-serialisable fields within the `http.Response` object. The error logged is `<<error: json: unsupported type: func() (io.ReadCloser, error)>>`, pointing towards an inability to serialise the `Body` field, which is of type `io.ReadCloser`.

      This function is designed to check if a GET request to the specified URL succeeds, logging detailed response information at higher verbosity levels for diagnostic purposes.

      Steps to Reproduce:
      1. Increase the logging level to 4.
      2. Perform an operation that triggers the `DoHTTPProbe` function.
      3. Review the logging output for the error message.

      Expected Behaviour:

      The logger should gracefully handle or exclude non-serialisable fields like `Body`, ensuring clean and informative logging output that aids in diagnostics without encountering serialisation errors.

      Actual Behaviour:

      Non-serialisable fields in the `http.Response` object lead to the error `<<error: json: unsupported type: func() (io.ReadCloser, error)>>` being logged. This diminishes the utility of logs for debugging at higher verbosity levels.

      Impact:

      The issue is considered of low severity since it only appears at logging level 4, which is beyond standard operational levels (level 2) used in production. Nonetheless, it could hinder effective diagnostics and clutter logs with errors when high verbosity levels are employed for troubleshooting.

      Suggested Fix:

      Modify the logging functionality within `DoHTTPProbe` to either filter out non-serialisable fields from the `http.Response` object or implement a custom serialisation approach that allows these fields to be logged in a more controlled and error-free manner.

            amcdermo@redhat.com ANDREW MCDERMOTT
            amcdermo@redhat.com ANDREW MCDERMOTT
            Shudi Li Shudi Li
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: