traceloop / traceloop/openllmetry
๐ Bug Report: Traceloop SDK does not always make an API request at the completion of a Colab/Jupyter notebook block
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.4k
- Forks
- 1.1k
- Avg merge
- 8d 14h
- Merged PRs (30d)
- 2
Description
Which component is this bug for?
Traceloop SDK
๐ Description
If you instantiate the Traceloop SDK in Block A:
from traceloop.sdk import Traceloop
import os
# This is just for easy illustrative purposes so people don't need to set up any API keys
os.environ['TRACELOOP_API_KEY'] = 'asdasd'
os.environ['TRACELOOP_BASE_URL'] = 'asdasd'
Traceloop.init(disable_batch=True)
and you run the following code in Block B:
from openai import OpenAI
api_key = input("Please enter your OpenAI API key: ")
client = OpenAI(api_key=api_key)
completion = client.chat.completions.create(
model='gpt-4o',
messages=[{"role":"user","content":"What's the meaning of life?"}]
)
print(completion.choices[0].message.content)
then the Traceloop SDK should send an API request at the completion of Block B to record the OpenAI request. With appropriate logging set, you can see that this is not the case.
I see https://github.com/traceloop/openllmetry/pull/66, but it seems like this same issue might have reared its head again. I swear this used to work.
๐ Reproduction steps
I have this notebook which reproduces the issue. If you run it, you should see that there is no Traceloop API call in the OpenAI call code block.
๐ Expected behavior
The API call should be triggered at the completion of every code block.
๐ Actual Behavior with Screenshots
The only API calls logged are OpenAI API calls.
๐ค Python Version
No response
๐ Provide any additional context for the Bug.
No response
๐ Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up โ it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Traceloop.init entry point and compare the reported behavior with pull request #66, then run the linked Colab notebook using the two-block reproduction. Done means an API request is logged at the completion of each notebook code block, including the OpenAI call in Block B.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100