Commit b1e1325
committed
observability: spec v0.7 OTel mapping (proposal 0007) — phase 6.0
Land the observability capability per spec proposal 0007. Adds
`openarmature.observability` with the §3 correlation_id ContextVar +
queue-mediated dispatch primitives (core, no OTel deps), and an
extras-gated `openarmature.observability.otel` subpackage with
`OTelObserver`, detached trace mode, LLM provider span hook, and the
log bridge.
Engine integration: `correlation_id` ContextVar set/reset around the
outermost `invoke()`; `_active_observers` and `_active_dispatch`
ContextVars set/reset around every chain invocation in
`_step_function_node` / `_step_subgraph_node` / `_step_fan_out_node`.
The LLM provider span hook in `OpenAIProvider.complete` calls
`current_dispatch()` to enqueue NodeEvent-shaped records on the same
delivery worker the engine uses, preserving spec §6 serial ordering.
OTelObserver implementation:
- Private TracerProvider per §6 — never registers globally.
- Subscribes to `started` / `completed` / `checkpoint_saved` phases.
- §4.5 subgraph dispatch span synthesis (the engine wrapper is
transparent per fixture 013, but observability mandates a span).
- §4.4 detached trace mode for subgraphs (one Link, two traces) and
fan-outs (one trace per instance, one Link per).
- §5 attribute population including the cross-cutting
`openarmature.correlation_id` on every span.
- §5.5 LLM provider span with `disable_llm_spans` opt-out.
- §10.8 checkpoint_saved → zero-duration
`openarmature.checkpoint.save` span.
- `spec_version` reads from `openarmature.__spec_version__` so the
three-place version sync covers the OTel surface automatically.
Charter alignment: OTel deps are optional via `pip install
openarmature[otel]`; correlation primitives stay in core. Plan to
lift `observability.otel` into a sibling `openarmature-otel` package
at the v1.0 launch alongside `openarmature-eval` per charter §3.2.
`opentelemetry-sdk>=1.27,<2` upper-bound guards against the SDK 2.x
LoggingHandler removal until the migration to
opentelemetry-instrumentation-logging lands.
Test coverage: 4 of 11 conformance fixtures driven end-to-end —
001 (basic trace), 005 (LLM provider span + isolation under
external auto-instrumentation), 008 (detached subgraph + detached
fan-out), 009 (correlation_id cross-cutting). The Phase 5 deferred
fixture 031 span/log assertions activate. The remaining 7 fixtures
defer to Phase 6.1 with per-fixture wiring notes (tracked in
openarmature-coord). 15 unit tests cover the engine path
independently of conformance harness wiring.1 parent 689c336 commit b1e1325
12 files changed
Lines changed: 2591 additions & 22 deletions
File tree
- src/openarmature
- graph
- llm/providers
- observability
- otel
- tests
- conformance
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
19 | 34 | | |
20 | 35 | | |
21 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
| |||
369 | 377 | | |
370 | 378 | | |
371 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
372 | 391 | | |
373 | 392 | | |
374 | 393 | | |
| |||
378 | 397 | | |
379 | 398 | | |
380 | 399 | | |
| 400 | + | |
381 | 401 | | |
382 | 402 | | |
383 | 403 | | |
| |||
585 | 605 | | |
586 | 606 | | |
587 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
588 | 617 | | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
596 | 629 | | |
597 | 630 | | |
598 | 631 | | |
| |||
649 | 682 | | |
650 | 683 | | |
651 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
652 | 692 | | |
653 | 693 | | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
664 | 708 | | |
665 | 709 | | |
666 | 710 | | |
| |||
740 | 784 | | |
741 | 785 | | |
742 | 786 | | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
743 | 794 | | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
749 | 804 | | |
750 | 805 | | |
751 | 806 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
190 | 193 | | |
191 | 194 | | |
192 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
193 | 231 | | |
194 | 232 | | |
195 | 233 | | |
| |||
481 | 519 | | |
482 | 520 | | |
483 | 521 | | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
484 | 580 | | |
485 | 581 | | |
486 | 582 | | |
| 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 | + | |
0 commit comments