Skip to content

Conversation

@Aaron1011
Copy link
Member

@Aaron1011 Aaron1011 commented Nov 6, 2025

Using a custom tracer can be required for traces to be correctly exported (e.g. with Arize), so an error creating a custom tracer might only ever show up in the logs. Let's reject the request when this happens, instead of continuing on and potentially failing to export the inference trace to OTEL.


Important

Reject requests if creating a custom OTEL tracer fails, ensuring proper trace exportation handling.

  • Behavior:
    • get_or_create_custom_tracer in TracerWrapper now returns Result<Context, Error> instead of Context.
    • make_otel_http_span now returns Result<Span, Error> and handles errors by rejecting requests if custom tracer creation fails.
    • tensorzero_otel_tracing_middleware updated to reject requests if make_otel_http_span returns an error.
  • Error Handling:
    • Logs error and rejects request if custom tracer creation fails in make_otel_http_span.
    • Uses map_err to handle errors in get_or_create_custom_tracer.
  • Misc:
    • Minor changes in mod.rs to support new error handling logic.

This description was created by Ellipsis for 59e7878. You can customize this summary. It will automatically update as commits are pushed.

Using a custom tracer can be required for traces to be correctly
exported (e.g. with Arize), so an error creating a custom tracer
might only ever show up in the logs. Let's reject the request when
this happens, instead of continuing on and potentially failing to
export the inference trace to OTEL.
Copilot AI review requested due to automatic review settings November 6, 2025 17:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling in the OpenTelemetry tracing middleware by converting silent error logging to proper error propagation. When custom tracer creation or HTTP span creation fails, the errors are now returned to the caller instead of being logged and ignored.

  • Changed get_or_create_custom_tracer to return Result<Context, Error> instead of Context
  • Changed make_otel_http_span to return Result<Span, Error> instead of Span
  • Updated error handling in tensorzero_otel_tracing_middleware to properly propagate errors from span creation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@virajmehta virajmehta added this pull request to the merge queue Nov 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants