Integrate inference smoke diagnostics
This commit is contained in:
@@ -117,12 +117,13 @@ func (c *Coordinator) generate(
|
||||
return finish(nil, err)
|
||||
}
|
||||
ordinal := attempts + 1
|
||||
outcome, dispatched, capacityWait, generationDuration := c.execute(ctx, req.Target.BackendID, prepared, captureEvidence)
|
||||
outcome, dispatched, capacityWait, generationDuration, startedAt := c.execute(ctx, req.Target.BackendID, prepared, captureEvidence)
|
||||
if dispatched {
|
||||
attempts++
|
||||
}
|
||||
if captureEvidence {
|
||||
attempt := AttemptEvidence{
|
||||
StartedAt: startedAt.UTC(),
|
||||
Dispatched: dispatched,
|
||||
ResponseReceived: outcome.Evidence.ResponseReceived,
|
||||
HTTP: cloneHTTPEvidence(outcome.Evidence),
|
||||
@@ -220,6 +221,7 @@ func (c *Coordinator) generateInjected(
|
||||
if err != nil {
|
||||
if captureEvidence {
|
||||
evidence.Attempts = append(evidence.Attempts, AttemptEvidence{
|
||||
StartedAt: start.UTC(),
|
||||
CapacityWait: capacityWait,
|
||||
Failure: ClassifyFailure(err),
|
||||
})
|
||||
@@ -234,6 +236,7 @@ func (c *Coordinator) generateInjected(
|
||||
release()
|
||||
if captureEvidence {
|
||||
evidence.Attempts = append(evidence.Attempts, AttemptEvidence{
|
||||
StartedAt: start.UTC(),
|
||||
CapacityWait: capacityWait,
|
||||
Failure: ClassifyFailure(err),
|
||||
})
|
||||
@@ -251,6 +254,7 @@ func (c *Coordinator) generateInjected(
|
||||
}
|
||||
if captureEvidence {
|
||||
attempt := AttemptEvidence{
|
||||
StartedAt: start.UTC(),
|
||||
Dispatched: true,
|
||||
ResponseReceived: response != nil,
|
||||
RequestDuration: duration,
|
||||
@@ -293,16 +297,17 @@ func (c *Coordinator) generateInjected(
|
||||
return finish(response, nil)
|
||||
}
|
||||
|
||||
func (c *Coordinator) execute(ctx context.Context, backendID string, prepared *llm.PreparedGeneration, captureEvidence bool) (outcome llm.AttemptOutcome, dispatched bool, capacityWait, generationDuration time.Duration) {
|
||||
func (c *Coordinator) execute(ctx context.Context, backendID string, prepared *llm.PreparedGeneration, captureEvidence bool) (outcome llm.AttemptOutcome, dispatched bool, capacityWait, generationDuration time.Duration, startedAt time.Time) {
|
||||
start := c.now()
|
||||
startedAt = start
|
||||
release, err := c.manager.Acquire(ctx, backendID)
|
||||
capacityWait = c.capacityWait(backendID, start)
|
||||
if err != nil {
|
||||
return llm.AttemptOutcome{Err: err}, false, capacityWait, 0
|
||||
return llm.AttemptOutcome{Err: err}, false, capacityWait, 0, startedAt
|
||||
}
|
||||
defer release()
|
||||
if err := ctx.Err(); err != nil {
|
||||
return llm.AttemptOutcome{Err: err}, false, capacityWait, 0
|
||||
return llm.AttemptOutcome{Err: err}, false, capacityWait, 0, startedAt
|
||||
}
|
||||
dispatchStart := c.now()
|
||||
if captureEvidence {
|
||||
@@ -312,7 +317,7 @@ func (c *Coordinator) execute(ctx context.Context, backendID string, prepared *l
|
||||
outcome = prepared.Execute(ctx)
|
||||
dispatched = true
|
||||
}
|
||||
return outcome, dispatched, capacityWait, elapsed(dispatchStart, c.now())
|
||||
return outcome, dispatched, capacityWait, elapsed(dispatchStart, c.now()), startedAt
|
||||
}
|
||||
|
||||
func (c *Coordinator) capacityWait(backendID string, start time.Time) time.Duration {
|
||||
|
||||
@@ -18,6 +18,7 @@ type GenerationEvidence struct {
|
||||
// AttemptEvidence describes one capacity acquisition and any dispatch it
|
||||
// reached. Generated content remains on the separate response return value.
|
||||
type AttemptEvidence struct {
|
||||
StartedAt time.Time
|
||||
Dispatched bool
|
||||
ResponseReceived bool
|
||||
HTTP llm.HTTPExecutionEvidence
|
||||
|
||||
Reference in New Issue
Block a user