Skip to content

Conversation

@jamesbaskerville
Copy link
Contributor

Infinite polling the export queue without a sleep was causing threads to take up a full core of CPU. Simple sleep fixes that.

block=False,
) # type: ignore
except EmptyQueue:
# Wait for the another span to arrive
Copy link
Contributor

Choose a reason for hiding this comment

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

fix typo

) # type: ignore
except EmptyQueue:
# Wait for the another span to arrive
time.sleep(0.1)
Copy link
Contributor

Choose a reason for hiding this comment

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

worth making it slightly longer? don't totally understand in what context this code is being used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's fine to make it longer, too. There's a task in the queue whenever a span should be exported which approximately means every generation/evaluation/call. In an evaluations.run setting with up to 20 workers that could happen quite a few times a second, but would probably be spiky given they're usually dependent on provider calls.

(exporter has 4 workers by default I think)

Copy link
Contributor

Choose a reason for hiding this comment

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

claude seems to give a range of 100-500ms as suitable generally when there's no need for realtime
• Real-time systems: 10-50ms
• Interactive applications: 50-100ms
• Background processing: 100-500ms
• Batch processing: 500ms+

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mmk, leaving as is sounds reasonable in that case

@andreibratu
Copy link

Can you merge in the release branch?

@jamesbaskerville jamesbaskerville changed the base branch from master to decorators-fixes March 7, 2025 18:14
Infinite polling the export queue without a sleep was causing threads to take up a full core of CPU. Simple sleep fixes that.
@jamesbaskerville jamesbaskerville merged commit e5d0525 into decorators-fixes Mar 7, 2025
6 checks passed
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.

5 participants