mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:53:10 +08:00
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:

committed by
GitHub

parent
97d568e60a
commit
8ee43f3705
@ -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:
|
||||
|
Reference in New Issue
Block a user