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.
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.