|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
RAII session returned by openinference_tracer.
More...
#include <openinference.h>
Public Member Functions | |
| void | close () |
| End the root span + any pending node spans. | |
| Span * | current_parent () const noexcept |
Internal — exposed so OpenInferenceProvider can open LLM child spans under the currently-active node span. | |
Public Attributes | |
| graph::GraphStreamCallback | cb |
Engine event callback. Pass to engine.run_stream(). | |
Friends | |
| NEOGRAPH_API OpenInferenceTracerSession | openinference_tracer (Tracer &, std::string, std::string) |
Open a CHAIN-kind root span and return a session whose cb opens per-node CHAIN child spans + LLM_TOKEN events under it. | |
RAII session returned by openinference_tracer.
Holds the root span (kept alive for the duration of the engine run) and the GraphStreamCallback wired to record per-node / streaming events under that root.
Usage:
close() is also called by the destructor — explicit close is recommended only when the user wants to inspect the tracer's exported spans before the session goes out of scope (e.g. in tests). Double-close is a no-op.
Definition at line 67 of file openinference.h.
| void neograph::observability::OpenInferenceTracerSession::close | ( | ) |
End the root span + any pending node spans.
Idempotent.
close() resets the internal unique_ptr<Span> over the root span (and the corresponding pending-node-span stacks). If your Tracer adapter handed out raw pointers into caller-owned span storage and stored them for post-close inspection, those pointers become dangling — any walk of "all spans I've recorded" after close() reads freed memory and may crash, hang, or print garbage (issue #24).The adapter must own the span DATA itself (not just the wrapper). Pattern: split a RecordedSpan (owned by the adapter in unique_ptrs) from the Span wrapper handed back to the OpenInference layer. The wrapper's destruction is then harmless — the recorded data lives in the adapter and survives close(). See tests/test_openinference_cpp.cpp (InMemoryTracer) and examples/49_openinference.cpp (PrintTracer) for the canonical shape.
|
friend |