MCPcopy Index your code
hub / github.com/coder/coder / RecordStreamRetry

Method RecordStreamRetry

coderd/x/chatd/chatloop/metrics.go:147–157  ·  view source on GitHub ↗

RecordStreamRetry increments stream_retries_total. The caller must obtain classified via chaterror.Classify (non-empty Kind). No-op when m is nil. The chain_broken label is "true" for chain anchor failures (e.g. OpenAI previous_response_id 404) recovered by the chatloop, and "false" otherwise.

(provider, model string, classified chaterror.ClassifiedError)

Source from the content-addressed store, hash-verified

145// anchor failures (e.g. OpenAI previous_response_id 404) recovered
146// by the chatloop, and "false" otherwise.
147func (m *Metrics) RecordStreamRetry(provider, model string, classified chaterror.ClassifiedError) {
148 if m == nil {
149 return
150 }
151 m.StreamRetriesTotal.WithLabelValues(
152 provider,
153 model,
154 string(classified.Kind),
155 strconv.FormatBool(classified.ChainBroken),
156 ).Inc()
157}
158
159// RecordToolError increments tool_errors_total for the given
160// tool. No-op when m is nil.

Callers 3

TestRecordStreamRetryFunction · 0.95
RunFunction · 0.80

Calls 1

WithLabelValuesMethod · 0.80

Tested by 2

TestRecordStreamRetryFunction · 0.76