Commit 371545a
authored
Migrate OTel observer LLM span to typed event (#142)
* Migrate OTel observer LLM span to typed event
Drive the openarmature.llm.complete span lifecycle from the typed
LlmCompletionEvent on the success path. The span opens and closes
in one shot at typed-event arrival, with start_time back-dated by
latency_ms so the duration reflects the adapter-boundary
measurement rather than dispatcher queue delay. Failure-path spans
continue to fire from the sentinel NodeEvent pair (the typed event
is success-only per proposal 0049 alternative 3). The §5.5
attribute set is unchanged.
Flip OpenAIProvider.populate_caller_metadata default from False to
True so the bundled OTel and Langfuse observers can emit the §5.6
openarmature.user.<key> span-attribute family without callers
having to opt in. The spec-defined opt-in mechanism is preserved;
only the python default flips.
* Address PR 142 review
Pass the typed LlmCompletionEvent to attribute_enrichers on the
success path instead of None; widens the enricher signature to
accept LlmCompletionEvent so enrichers can read LLM-call context
that the sentinel-pair path used to expose via the closing
NodeEvent.
Switch the shared typed-event test helper's default node_name and
namespace to "ask" so they reflect the calling-node semantics the
typed event documents, not the legacy sentinel value.1 parent cf76c53 commit 371545a
8 files changed
Lines changed: 530 additions & 311 deletions
File tree
- src/openarmature
- graph
- llm/providers
- observability/otel
- tests
- _helpers
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | | - | |
543 | | - | |
544 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
545 | 549 | | |
546 | 550 | | |
547 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| |||
0 commit comments