opik icon indicating copy to clipboard operation
opik copied to clipboard

[FR]: expose SDK to upload spans / traces

Open skrawcz opened this issue 9 months ago • 1 comments

Proposal summary

Arize Phoenix has an API where one can upload spans / traces from another source. I would like this same capability for Opik as it does not appear that the Opik client exposes this.

import opik
client = opik.Opik()

#  load spans from somewhere, e.g. other place like Arize, or from `search_spans` call & do a transformation to that
spans = ... 

# new API call here:
client.upload_spans(spans, project="some_other_project")

Motivation

Motivations:

  • importing data from other sources
  • be able to curate trace data sets yourself (seems like copy_traces gets at some of this -- minus any transforms)

In the interim, one could reach into the SDK and mirror most of the code in copy_traces assuming one knows the schema.

skrawcz avatar Apr 01 '25 23:04 skrawcz

Hi @skrawcz,

Thank you for your suggestion. Let us look at it, and we will update you as soon as possible. It would be a nice addition.

thiagohora avatar Apr 02 '25 08:04 thiagohora

Hi @skrawcz although it's not 100% what you described in your comment, you can definitely upload your spans and traces to an Opik project using our current tracing SDK.

If you’re migrating or generating spans programmatically and just need to ingest them into a project, you can loop over them and call our trace logging endpoint. The SDK supports this pattern, and it’s documented here: 👉 https://www.comet.com/docs/opik/tracing/log_traces#logging-traces-and-spans

Let us know if this does the trick for you!

juanferrub avatar Jun 18 '25 12:06 juanferrub

Hi @skrawcz,

Thank you for your interest! Our Python SDK provides dedicated API clients that allow you to upload traces and spans from external sources. You can find more details in our documentation:

As there are no further questions at the moment, I’ll go ahead and close this issue. If you need any additional assistance, please feel free to reopen it or reach out—I'm happy to help. Have a great day!

andrescrz avatar Nov 24 '25 14:11 andrescrz