Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracing generator functions #3424

Open
danem opened this issue Jan 16, 2025 · 5 comments
Open

Tracing generator functions #3424

danem opened this issue Jan 16, 2025 · 5 comments

Comments

@danem
Copy link

danem commented Jan 16, 2025

Weave Version: 0.51.28
Python version: 3.12.8

I've found that functions returning a generator aren't properly traced.

For example:

@weave.op()
def b():
  return 1


@weave.op()
def a():
  yield b() + 1

weave.init("test")
for x in a():
    print(x)

Results in two separate traces:

Image

While this works properly:

@weave.op()
def b():
  return 1


@weave.op()
def a():
    return b() + 1

This is relevant for tracing functions that stream results back to the user.

@danem danem closed this as completed Jan 16, 2025
@danem danem reopened this Jan 16, 2025
@jamie-rasmussen
Copy link
Collaborator

Thanks for reporting, we have a corresponding issue in our internal tracker, WB-19801.

@danem
Copy link
Author

danem commented Jan 17, 2025

Thanks! Any idea when it might be addressed? I'm evaluating different observability tools, and while this isn't a deal breaker or anything it is rather annoying given our usage.

@jamie-rasmussen
Copy link
Collaborator

I can tell you that this hasn't been selected for development in the next few weeks, but we can't yet commit to a time frame for when it might be. I can also say that a number of users have mentioned it, which does help with its prioritization.

@jdai1
Copy link

jdai1 commented Jan 20, 2025

@danem Hey! I'm also in the same boat as you here — the streaming thing is kind of annoying. I'm wondering if you had any super positive experiences with other LLM observability tools relative to Weave?

@nataliachodelski
Copy link

nataliachodelski commented Jan 23, 2025

@jamie-rasmussen - I found this recent PR from Data Dog's python client in which they addressed issues they had decorating sync and async generator functions and thought it might be helpful to the weave team re: fixing this bug.

DataDog/dd-trace-py#11413

it looks like the function they're using to determine if a function returns a generator is isgeneratorfunction, which is coming from from inspect import isgeneratorfunction via this file: https://github.com/DataDog/dd-trace-py/blob/main/ddtrace/internal/compat.py

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

No branches or pull requests

4 participants