Commit 4ec6149
committed
feat(deepseek): add DeepSeek instrumentation with R1 reasoning_content support
Adds opentelemetry-instrumentation-deepseek package for tracing DeepSeek API
calls. Closes #2597.
DeepSeek has no native tracing support in OpenLLMetry. Users calling
DeepSeek-R1 also lose visibility into reasoning_content (chain-of-thought
output) which is not captured by the existing OpenAI instrumentation.
- Patches openai.resources.chat.completions (DeepSeek is OpenAI-compatible)
- Only activates when base_url contains "deepseek" via _is_deepseek_client()
- Captures reasoning_content as gen_ai.deepseek.reasoning_content span attribute
- Accumulates reasoning_content across streaming chunks
- Follows the Groq instrumentation structure exactly1 parent fc33f1c commit 4ec6149
26 files changed
Lines changed: 4315 additions & 71 deletions
File tree
- packages
- opentelemetry-instrumentation-deepseek
- opentelemetry/instrumentation/deepseek
- tests
- data
- traces
- sample-app
- traceloop-sdk
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments