(t *testing.T)
| 388 | } |
| 389 | |
| 390 | func TestRecordToolError(t *testing.T) { |
| 391 | t.Parallel() |
| 392 | |
| 393 | t.Run("nil metrics does not panic", func(t *testing.T) { |
| 394 | t.Parallel() |
| 395 | var m *chatloop.Metrics |
| 396 | m.RecordToolError("anthropic", "claude-sonnet-4-5", "test") |
| 397 | }) |
| 398 | |
| 399 | t.Run("increments with correct labels", func(t *testing.T) { |
| 400 | t.Parallel() |
| 401 | |
| 402 | reg := prometheus.NewRegistry() |
| 403 | m := chatloop.NewMetrics(reg) |
| 404 | m.RecordToolError("test-provider", "test-model", "read_file") |
| 405 | |
| 406 | requireCounter(t, reg, "coderd_chatd_tool_errors_total", 1, map[string]string{ |
| 407 | "provider": "test-provider", |
| 408 | "model": "test-model", |
| 409 | "tool_name": "read_file", |
| 410 | }) |
| 411 | }) |
| 412 | } |
| 413 | |
| 414 | func TestRun_RecordsMetrics(t *testing.T) { |
| 415 | t.Parallel() |
nothing calls this directly
no test coverage detected