Log duration_ms when Workhorse hits a bad gateway
Previously when the upstream application (e.g. Unicorn) timed out, Workhorse would report an error message of the form:
{
"correlation_id": "k4mKg0snXG3",
"error": "badgateway: failed after 61s: EOF",
"level": "error",
"method": "GET",
"msg": "error",
"time": "2019-12-02T22:05:09-08:00",
"uri": "/admin"
}
Since Sentry attempts to group similar events by some fingerprint that includes the message, the changes in timings would trick Sentry into creating a new event. To avoid that, the new log message now looks like:
{
"correlation_id": "k4mKg0snXG3",
"duration_ms": 60599,
"error": "badgateway: failed to receive response: EOF",
"level": "error",
"method": "GET",
"msg": "error",
"time": "2019-12-02T22:05:09-08:00",
"uri": "/admin"
}
The inclusion of duration_ms
and the standardized error
message makes
it easier for users to filter and parse this error.