Files
traces/pkg/util/errors.go
Suraj NathandGitHub 0011991733 slo: include all request cancellations within SLO (#4355)
* slo: include all request cancellations within SLO

* Update CHANGELOG.md

* cleanup and fix bad log line

* add result label in within_slo metrics

* return ctx errors and add span events in pipeline collectors

* update changelog and local docker-compose

* add result in the total metric as well
2024-11-26 22:28:40 +05:30

29 lines
657 B
Go

package util
import (
"errors"
"fmt"
"net/http"
)
var (
// ErrTraceNotFound can be used when we don't find a trace
ErrTraceNotFound = errors.New("trace not found")
// StatusClientClosedRequest is the status code for when a client request cancellation of an http request
StatusClientClosedRequest = 499
StatusTextClientClosedRequest = "Request Cancelled"
ErrUnsupported = fmt.Errorf("unsupported")
)
func StatusText(code int) string {
switch code {
case StatusClientClosedRequest:
// 499 doesn't have status text in http package, so we define it here
return StatusTextClientClosedRequest
default:
return http.StatusText(code)
}
}