Commit 23c4d38
Instrument complete instead of ask (#16)
RubyLLM's Rails/ActiveRecord integration (acts_as_chat) defines its own
ask method that calls RubyLLM::Chat#complete directly, bypassing the
instrumentation's patched #ask method. By instrumenting #complete instead,
all LLM API calls are captured regardless of the entry point.
This also means tool call flows now produce one chat span per API call
rather than a single span wrapping the entire ask loop, giving better
visibility into each individual LLM request.
Closes #15
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c75f29f commit 23c4d38
2 files changed
Lines changed: 36 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
95 | 128 | | |
96 | 129 | | |
97 | 130 | | |
| |||
155 | 188 | | |
156 | 189 | | |
157 | 190 | | |
158 | | - | |
| 191 | + | |
159 | 192 | | |
160 | 193 | | |
161 | 194 | | |
| |||
0 commit comments