[opentelemetry-instrumentation-genai-langchain] Capture top_k and choice count on chat - #684
Draft
rads-1996 wants to merge 2 commits into
Draft
[opentelemetry-instrumentation-genai-langchain] Capture top_k and choice count on chat#684rads-1996 wants to merge 2 commits into
rads-1996 wants to merge 2 commits into
Conversation
Pull request dashboard statusWaiting on the author · refreshed 2026-09-11 21:40 UTC Move out of draft to request review. Status above doesn't look right?
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds LangChain chat extraction for top_k and requested choice count.
Changes:
- Captures
top_kandnfrom invocation parameters. - Adds unit tests for populated and missing values.
- Adds a changelog fragment.
File summaries
| File | Description |
|---|---|
| instrumentation/opentelemetry-instrumentation-genai-langchain/tests/test_callback_handler.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/callback_handler.py | Updated as part of this pull request. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/.changelog/684.added | Updated as part of this pull request. |
Review details
Suppressed comments (1)
instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/callback_handler.py:305
- Please keep this consistent with the existing choice-count behavior: older
ChatOpenAIrequests can include the SDK defaultn=1, but this assignment reports it unconditionally. The OpenAI instrumentation intentionally omitsgen_ai.request.choice.countforn=1(openai/utils.py:137-140,test_chat_completions.py:461-485), so assign only a non-default integer count here and add a regression test for the default.
request_choice_count = params.get("n")
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
rads-1996
marked this pull request as draft
September 11, 2026 21:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #581
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. List any relevant details for your test
configuration.
Checklist
See CONTRIBUTING.md
for the style guide, changelog guidance, and more.