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

Function extractEndpointLabel

coderd/x/chatd/chatdebug/summary.go:194–214  ·  view source on GitHub ↗

extractEndpointLabel scans steps for the first completed attempt with a non-empty path and returns "METHOD /path" (or just "/path").

(steps []database.ChatDebugStep)

Source from the content-addressed store, hash-verified

192// extractEndpointLabel scans steps for the first completed attempt with a
193// non-empty path and returns "METHOD /path" (or just "/path").
194func extractEndpointLabel(steps []database.ChatDebugStep) string {
195 for _, step := range steps {
196 if len(step.Attempts) == 0 {
197 continue
198 }
199 var attempts []attemptLabel
200 if err := json.Unmarshal(step.Attempts, &attempts); err != nil {
201 continue
202 }
203 for _, a := range attempts {
204 if a.Status != attemptStatusCompleted || a.Path == "" {
205 continue
206 }
207 if a.Method != "" {
208 return a.Method + " " + a.Path
209 }
210 return a.Path
211 }
212 }
213 return ""
214}

Callers 1

AggregateRunSummaryMethod · 0.85

Calls 1

UnmarshalMethod · 0.45

Tested by

no test coverage detected