feat: add new Opik Tracer (#6928)

* feat: add new Opik Tracer

This PR adds a new Tracer to sends traces and spans to Opik.

* Fix typo in docs

* Optimize Opik integration to reduce number of HTTP calls

* Add session_id and user_id to the Opik tracer

* Check Opik configuration on the client side before making a remote check

* Tackle documentation reviews

* Apply suggestions from code review

Co-authored-by: Jacques Verré <jverre@gmail.com>

* Fix one of the doc link

* Explicitely check for Opik environment variables before enabling the Opik tracer

* test: add opik tracing unit tests

---------

Co-authored-by: Nadir J <31660040+NadirJ@users.noreply.github.com>
Co-authored-by: Jacques Verré <jverre@gmail.com>
Co-authored-by: Ítalo Johnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
Boris Feld 2025-03-21 19:18:19 +01:00 committed by GitHub
commit 8c2f6addf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 567 additions and 5 deletions

View file

@ -135,6 +135,10 @@ def mock_tracers():
"langflow.services.tracing.service._get_arize_phoenix_tracer",
return_value=MockTracer,
),
patch(
"langflow.services.tracing.service._get_opik_tracer",
return_value=MockTracer,
),
):
yield
@ -294,7 +298,7 @@ async def test_get_langchain_callbacks(tracing_service):
assert tracer.get_langchain_callback_called
# Verify returned callbacks list length
assert len(callbacks) == 4 # Four tracers
assert len(callbacks) == 5 # Five tracers
# Cleanup
await tracing_service.end_tracers({})