Instrumentation: Add status_source label to request metrics/logs (#74114)

Ref #68480

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
This commit is contained in:
Marcus Efraimsson
2023-09-11 12:13:13 +02:00
committed by GitHub
parent 97d568e60a
commit 8ee43f3705
27 changed files with 487 additions and 67 deletions

View File

@ -46,6 +46,15 @@ const (
// features.
// HTTP status code 501.
StatusNotImplemented CoreStatus = "Not implemented"
// StatusBadGateway means that the server, while acting as a proxy,
// received an invalid response from the downstream server.
// HTTP status code 502.
StatusBadGateway CoreStatus = "Bad gateway"
// StatusGatewayTimeout means that the server, while acting as a proxy,
// did not receive a timely response from a downstream server it needed
// to access in order to complete the request.
// HTTP status code 504.
StatusGatewayTimeout CoreStatus = "Gateway timeout"
)
// StatusReason allows for wrapping of CoreStatus.
@ -69,7 +78,7 @@ func (s CoreStatus) HTTPStatus() int {
return http.StatusForbidden
case StatusNotFound:
return http.StatusNotFound
case StatusTimeout:
case StatusTimeout, StatusGatewayTimeout:
return http.StatusGatewayTimeout
case StatusTooManyRequests:
return http.StatusTooManyRequests
@ -77,6 +86,8 @@ func (s CoreStatus) HTTPStatus() int {
return http.StatusBadRequest
case StatusNotImplemented:
return http.StatusNotImplemented
case StatusBadGateway:
return http.StatusBadGateway
case StatusUnknown, StatusInternal:
return http.StatusInternalServerError
default: