chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
14.96k stars 1.26k forks source link

[Feature Request]: Return trace information #1275

Open tazarov opened 11 months ago

tazarov commented 11 months ago

Describe the problem

When OTEL is enabled, it would be beneficial to receive traceId information on failures or upon specifically requesting traceId from client-side for a particular operation.

Describe the proposed solution

Return traceId in the header or the JSON response from Chroma API.

Alternatives considered

N/A

Importance

would make my life easier

Additional Information

No response

tazarov commented 11 months ago

I realize that getting traceId in JSON response might be a tall order given that Chroma API does not return generic responses where such info can easily be provided as inband metadata.

{
 "data": {...},
"message": "success",
....
"traceId":"e8cb65e3ad4c30b9de68cc8b10e65e95"
}

So perhaps we can communicate that through headers (which can be tricky with proxies) and then materialize that via methods on the client:

client.enable_tracing()
client.create_collection(...) #returning a header "X-Trace-ID"
client.get_last_operation_trace_id()
client.disable_tracing()