mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* 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
29 lines
657 B
Go
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)
|
|
}
|
|
}
|