Troubleshooting Arize Phoenix Client for Logging Spans
Hi! We are trying to use the phoenix client for our application with self hosted phoenix in docker instead of just having the whole phoenix package but we are having some problems when trying to log traces:
There is not function log_traces in the phoenix client, for a workaround we thought to use the log_spans that is included in the client and use a span dict similar to the one appearing in the docs
This log_spans is still not working, even when we try the examples appearing in the docs to log a span like this it is still failing:
# Log spans
>>> spans = [
... {
... "id": "1",
... "name": "test",
... "context": {"trace_id": "123", "span_id": "456"},
... }
... ]
>>> result = client.spans.log_spans(
... project_identifier="my-project",
... spans=spans
... )File "/app/src/tracing.py", line 245, in log_traces 2025-07-18T08:37:04.406023514Z self.client.spans.log_spans(project_identifier=self.project, spans=spans_test) 2025-07-18T08:37:04.406024556Z ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-07-18T08:37:04.406025556Z File "/app/.venv/lib/python3.13/site-packages/phoenix/client/resources/spans/__init__.py", line 477, in log_spans 2025-07-18T08:37:04.406026639Z result = _parse_log_spans_response(response, spans) 2025-07-18T08:37:04.406027598Z File "/app/.venv/lib/python3.13/site-packages/phoenix/client/resources/spans/__init__.py", line 1103, in _parse_log_spans_response 2025-07-18T08:37:04.406033598Z _raise_log_spans_error(error_response) 2025-07-18T08:37:04.406035431Z ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ 2025-07-18T08:37:04.406036431Z File "/app/.venv/lib/python3.13/site-packages/phoenix/client/resources/spans/__init__.py", line 1186, in _raise_log_spans_error 2025-07-18T08:37:04.406037514Z raise SpanCreationError( 2025-07-18T08:37:04.406038431Z ...<7 lines>... 2025-07-18T08:37:04.406039431Z ) 2025-07-18T08:37:04.406040306Z phoenix.client.exceptions.SpanCreationError: Failed to queue 4 invalid spans: 2025-07-18T08:37:04.406041348Z - Span 456: Field required 2025-07-18T08:37:04.406042264Z - Span 456: Field required 2025-07-18T08:37:04.406043181Z - Span 456: Field required 2025-07-18T08:37:04.406044098Z - Span 456: Field required And when we tried to log our own spans that response is: phoenix.client.exceptions.SpanCreationError: Failed to queue 2 invalid spans: 2025-07-18T08:39:51.549170011Z - Span fd009643dec342d1b8c15b180ac756f5: Input should be a valid string 2025-07-18T08:39:51.549171302Z - Span e43bf40ea0f84803a10c3be95578fe90: Input should be a valid string How can we use the arize-phoenix-client to log our spans? We would like to avoid using the whole arize-phoenix package to reduce overhead. Thank you so much!!
