Skip to content

[OPIK-5499] [SDK] update_current_trace not exported at top-level opik module#6056

Merged
yaricom merged 1 commit intomainfrom
yaricom/OPIK-5499-exporting-update_current_trace
Apr 2, 2026
Merged

[OPIK-5499] [SDK] update_current_trace not exported at top-level opik module#6056
yaricom merged 1 commit intomainfrom
yaricom/OPIK-5499-exporting-update_current_trace

Conversation

@yaricom
Copy link
Copy Markdown
Contributor

@yaricom yaricom commented Apr 2, 2026

Details

Source: Claude session 1, issue #1

opik.track, opik.configure, opik.Opik, opik.AgentConfig, and opik.flush_tracker are all importable directly from opik. However, update_current_trace lives only in opik.opik_context. A user who follows the pattern of the other top-level APIs will naturally write opik.update_current_trace(...) and get an AttributeError.

This is the most common way to attach metadata inside a tracked function, so it should be a first-class top-level export.

Steps to reproduce:

  1. Decorate a function with @opik.track(...)
  2. Inside it, call opik.update_current_trace(metadata={...})
  3. Get AttributeError: module 'opik' has no attribute 'update_current_trace'

Additionally, Python's error suggestion says "Did you mean: 'start_as_current_trace'" which is a completely different function, sending users down the wrong path.

Severity:

Major

Summary of changes

Added update_current_trace and update_current_span to SDK exports in __init__.py.

Change checklist

  • User facing
  • Documentation update

Issues

  • Resolves #
  • OPIK-5499

AI-WATERMARK

AI-WATERMARK: [yes|no]

  • If yes:
    • Tools:
    • Model(s):
    • Scope:
    • Human verification:

Testing

Manually checked

Documentation

No changes

@yaricom yaricom requested a review from a team as a code owner April 2, 2026 10:49
@github-actions github-actions bot added python Pull requests that update Python code Python SDK labels Apr 2, 2026
Copy link
Copy Markdown
Contributor

@ldaugusto ldaugusto left a comment

Choose a reason for hiding this comment

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

LGTM

@yaricom yaricom merged commit 153a2ee into main Apr 2, 2026
132 checks passed
@yaricom yaricom deleted the yaricom/OPIK-5499-exporting-update_current_trace branch April 2, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python SDK python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants