Skip to content

Conversation

@antonpirker
Copy link
Contributor

response of chat will follow soon.

@antonpirker antonpirker requested a review from a team as a code owner August 13, 2025 13:25
@antonpirker antonpirker merged commit 1fbdabe into shellmayr/feat/langchain-integration-update Aug 13, 2025
115 of 122 checks passed
@antonpirker antonpirker deleted the antonpirker/langchain1 branch August 13, 2025 13:28
@codecov
Copy link

codecov bot commented Aug 13, 2025

❌ 20 Tests Failed:

Tests completed Failed Passed Skipped
23425 20 23405 2280
View the top 3 failed test(s) by shortest run time
tests.integrations.langchain.test_langchain::test_langchain_agent[False-True-False]
Stack Traces | 0s run time
tests/conftest.py:99: in _
    reraise(*e)
sentry_sdk/utils.py:1751: in reraise
    raise value
sentry_sdk/integrations/langchain.py:491: in on_agent_finish
    span_data = self.span_map[run_id]
                ^^^^^^^^^^^^^^^^^^^^^
E   KeyError: UUID('eedb5893-b195-4b0d-84a7-29bdfe4e9164')
tests.integrations.langchain.test_langchain::test_langchain_agent[True-False-False]
Stack Traces | 0s run time
tests/conftest.py:99: in _
    reraise(*e)
sentry_sdk/utils.py:1751: in reraise
    raise value
sentry_sdk/integrations/langchain.py:491: in on_agent_finish
    span_data = self.span_map[run_id]
                ^^^^^^^^^^^^^^^^^^^^^
E   KeyError: UUID('0a8ae1f1-8481-42c0-af2d-86ac06d8fd79')
tests.integrations.langchain.test_langchain::test_langchain_agent[True-True-False]
Stack Traces | 0s run time
tests/conftest.py:99: in _
    reraise(*e)
sentry_sdk/utils.py:1751: in reraise
    raise value
sentry_sdk/integrations/langchain.py:491: in on_agent_finish
    span_data = self.span_map[run_id]
E   KeyError: UUID('6eaaadf6-8a86-48c9-9d64-5b6e74bcf908')

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

for key, attribute in DATA_FIELDS.items():
if key in all_params:
set_data_normalized(span, attribute, all_params[key], unpack=False)

Copy link

Choose a reason for hiding this comment

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

Bug: Callback Argument Error Causes Telemetry Loss

The on_chat_model_start callback calls set_data_normalized with an unpack=False keyword argument. This likely causes a TypeError that's silently swallowed, preventing request parameters from being recorded on chat spans and degrading telemetry.

Fix in Cursor Fix in Web

input_tokens=input_tokens,
output_tokens=output_tokens,
total_tokens=total_tokens,
)
Copy link

Choose a reason for hiding this comment

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

Bug: Token Usage Metrics Inflated Due to Integration Change

The Langchain integration now unconditionally records token usage for both chat and generic LLM spans. The no_collect_tokens guard, which previously prevented double-counting for models with dedicated Sentry integrations, was removed. This leads to inflated token usage metrics in production.

Additional Locations (1)
Fix in Cursor Fix in Web

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.

2 participants