hampusohlsson
hampusohlsson

Reputation: 10219

How to populate response code in StackDriver ErrorReporting UI

Like the title suggests, I'm wondering how to populate the response code column in the GCP StackDriver ErrorReporting UI. Attached a screenshot for clarification.

I'm using Golang and the cloud.google.com/go/errorreporting package to report custom errors, with this following code.

client.Report(errorreporting.Entry{
    User:  username,
    Error: err,
})

I know there's an option to attach a Req field, but after reading the errorreporting source code, it's not clear how that would work. It looks like the source code doesn't actually read the response status code from the request object.

Any pointers appreciated.

screenshot

Upvotes: 0

Views: 141

Answers (1)

Kirk Kelsey
Kirk Kelsey

Reputation: 4544

Agreed, it looks like this isn't possible with the Go client today.

The client could be updated to populate the HttpRequestContext.response_status_code (Protobuff) field based on the Entry.Req.Response.StatusCode (Go) value, like

                RemoteIp:           r.RemoteAddr,
+               ResponseStatusCode: r.Response.StatusCode,
            },

The best option would be to file a feature request (or pull request) at https://github.com/googleapis/google-cloud-go/

Upvotes: 1

Related Questions