feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -18,19 +18,25 @@ const (
|
||||
)
|
||||
|
||||
// ClassifyRelayOutcome decides whether one finished relay counts as a health
|
||||
// sample. Business rejections and client cancellations are not samples; the
|
||||
// classification is independent of retries, channel disabling and billing.
|
||||
// sample. Business rejections and cancellations during generation are not
|
||||
// samples; a stream already completed normally without errors remains eligible
|
||||
// after its context is canceled. Classification is independent of retries,
|
||||
// channel disabling and billing.
|
||||
func ClassifyRelayOutcome(ctx context.Context, info *relaycommon.RelayInfo, apiErr *types.NewAPIError) Outcome {
|
||||
if info == nil || info.PerformanceBusinessRejection {
|
||||
return OutcomeIgnored
|
||||
}
|
||||
if ctx != nil && ctx.Err() == context.Canceled {
|
||||
stream := info.StreamStatus.OutcomeSnapshot()
|
||||
completedNormally := info.IsStream && info.StreamStatus != nil && apiErr == nil &&
|
||||
stream.Response == relaycommon.ResponseOutcomeCompleted &&
|
||||
(stream.EndReason == relaycommon.StreamEndReasonEOF || stream.EndReason == relaycommon.StreamEndReasonDone) &&
|
||||
!stream.HasErrors && info.StreamStatus.EndError == nil
|
||||
if ctx != nil && ctx.Err() == context.Canceled && !completedNormally {
|
||||
return OutcomeIgnored
|
||||
}
|
||||
if apiErr != nil && errors.Is(apiErr, context.Canceled) {
|
||||
return OutcomeIgnored
|
||||
}
|
||||
stream := info.StreamStatus.OutcomeSnapshot()
|
||||
if stream.Response == relaycommon.ResponseOutcomeFailed {
|
||||
return classifyFailure(false, stream.ErrorCode, stream.ErrorType, stream.ErrorStatus)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user