You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add public force_flush() to OTel and Langfuse observers (#83)
* Add public force_flush() to OTel and Langfuse observers
Downstream users reach into observer._provider directly to drain
the BatchSpanProcessor's outbound buffer in fast-teardown harnesses
(serverless functions, CLI one-shots, FastAPI TestClient teardown).
Expose force_flush(timeout_ms) as a stable surface instead.
OTelObserver.force_flush wraps self._provider.force_flush. Distinct
from CompiledGraph.drain, which covers the engine's observer-event
queue; force_flush covers the SpanProcessor export buffer.
LangfuseObserver.force_flush delegates to LangfuseClient.force_flush,
a new Protocol method. InMemoryLangfuseClient implements it as a
no-op (no buffer); LangfuseSDKAdapter delegates to the SDK's flush().
* Tighten force_flush contract docs; add adapter test
Narrow the LangfuseClient.force_flush Protocol contract to call out
that deadline honor is best-effort: SDK adapters wrapping clients
without timeout-propagation surfaces (the v4 Langfuse SDK) may
ignore timeout_ms and rely on the SDK's internal defaults.
Tighten the LangfuseSDKAdapter.force_flush docstring to make the
synchronous-but-not-deadline-honoring behavior explicit (the v4 SDK
flush IS synchronous — it blocks on tracer_provider.force_flush plus
score/media queue joins — but takes no timeout parameter and
discards the OTel return value).
Rewrite a stale comment in the adapter integration test that wrongly
claimed flush() was async — it isn't.
Add test_adapter_force_flush_delegates_to_client that uses
Mock(wraps=...) to verify the adapter invokes the wrapped SDK's
flush() and returns True.
0 commit comments