- Notifications
You must be signed in to change notification settings - Fork567
fix(langchain): Makespan_map an instance variable#4476
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix(langchain): Makespan_map an instance variable#4476
Conversation
codecovbot commentedJun 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@## master #4476 +/- ##==========================================- Coverage 80.70% 80.69% -0.02%========================================== Files 156 156 Lines 16475 16474 -1 Branches 2799 2799 ==========================================- Hits 13296 13293 -3- Misses 2296 2298 +2 Partials 883 883
|
329ed33 to906f75fCompare906f75f to876e6fbCompare
sentrivana left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Q: Was this an actual problem or is this more of a nice-to-have small refactor? As I understand from the other PR, we're actively avoiding having more than oneSentryLangchainCallback around at a time.
I think the change itself is fine but we don't need tests for an implementation detail like this. We also don't test thatmax_span_map_size,include_prompts, etc. are not shared between instances. (And we also shouldn't test that, because it's not behavior worth testing, and the tests would just add clutter without any signal.)
sentrivana left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
See previous comment, looks good but let's remove the tests (or at leasttest_span_map_not_class_attribute)
szokeasaurusrex commentedJun 25, 2025
@sentrivana Yes, so the problem occurred when attempting to reproduce#4443. I was confused why, despite having two callbacks, the data in Sentry was not duplicated. I assumed that perhaps the The reason, of course, is that the first callback which ends deletes the span from the Of course, you are right that we try to only have one callback per LLM request in#4485. But, what happens if we have concurrent requests to LLMs, or some other more complex setup, where having two callbacks would be expected? I am unsure how realistic such setups are, but if they do occur, I am pretty confident that we don't want the span map to be shared between the instances. |
sentrivana commentedJun 25, 2025
Not against the change itself, seems reasonable in any case. I was more pondering if this is behavior that needs testing (rather than a small internal refactor), but if you believe it is, I'd say |
szokeasaurusrex commentedJun 25, 2025
sounds reasonable, the first test is definitely more important anyhow |
876e6fb tobecd3eaComparebecd3ea tod71743fCompare7804260 intomasterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
span_mapshould be an instance variable; otherwise, separate instances of theSentryLangchainCallbackshare the samespan_mapobject, which is clearly not intended here.Also, remove the
max_span_map_sizeclass variable, it is always set on the instance, and so not needed.Ref#4443