Add update_span method#25
Conversation
| LogDestination::playground_logs(object_id.clone()) | ||
| } | ||
| }, | ||
| _ => LogDestination::project_logs("unknown".to_string()), |
There was a problem hiding this comment.
is this intended behavior?
There was a problem hiding this comment.
ah no, im gonna drop the update if it's an uknown span object type.
| Some(ParentSpanInfo::Dataset { object_id }) => { | ||
| LogDestination::dataset(object_id.clone()) | ||
| let destination = if let Some(span_components) = span_components.as_ref() { | ||
| if let Some(object_id) = span_components.object_id.as_ref() { |
There was a problem hiding this comment.
better to use a match statement here, so it's clear that the options are exhaustive
| /// Update an existing span using the output of `SpanHandle::export()`. | ||
| /// | ||
| /// Validation happens before queuing. The actual upload remains asynchronous. | ||
| pub async fn update_span(&self, exported: &str, event: crate::span::SpanLog) -> Result<()> { |
There was a problem hiding this comment.
maybe for a separate change (i think Stephen Belanger (@Qard) is thinking about this..) but does this have to be async?
There was a problem hiding this comment.
Yeah, the aim is to work towards limiting async to internal code. We have a background working doing all the async request dispatching and then all user-facing APIs are basically just fire-and-forget style other than an explicit flush_and_wait. We may want some other interfaces exposing asynchronous functions, but the idea is that we should not be forcing end user code to be async by making our API surface only usable in an async runtime.
There was a problem hiding this comment.
going to defer this to unblock gateway. i think we should probably address background_login since we need to resolve credentials before shipping off to queue.
https://github.com/braintrustdata/braintrust-sdk-rust/blob/main/src/logger.rs#L599
This PR adds
update_spanmethod similar to the typescript/python sdk