-
Notifications
You must be signed in to change notification settings - Fork 801
feat(semconv): expand traceloop span kind #3389
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
Open
minimAluminiumalism
wants to merge
1
commit into
traceloop:main
Choose a base branch
from
minimAluminiumalism:spankind
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
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.
Important
Looks good to me! 👍
Reviewed everything up to 7e7fc67 in 2 minutes and 8 seconds. Click for details.
- Reviewed
574
lines of code in5
files - Skipped
1
files when reviewing. - Skipped posting
9
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/opentelemetry-instrumentation-langchain/opentelemetry/instrumentation/langchain/__init__.py:86
- Draft comment:
The new wrapper for CallbackManager.configure is well integrated. Ensure that duplicate handler additions are avoided if the method is invoked multiple times. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. packages/opentelemetry-instrumentation-langchain/opentelemetry/instrumentation/langchain/__init__.py:168
- Draft comment:
Properly unwrapping CallbackManager.configure in _uninstrument ensures clean removal. This is consistent with the instrumentation logic. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. packages/opentelemetry-instrumentation-langchain/opentelemetry/instrumentation/langchain/callback_handler.py:381
- Draft comment:
The new _determine_llm_span_kind method is clear and assigns span kind based on the serialized model info. Consider caching the lowercased class name to avoid recalculating in multiple conditions. - Reason this comment was not posted:
Comment looked like it was already resolved.
4. packages/opentelemetry-instrumentation-langchain/opentelemetry/instrumentation/langchain/callback_handler.py:395
- Draft comment:
The _determine_chain_span_kind function covers various scenarios well. For minor performance and consistency gains, consider storing the lowercased class name in a variable instead of repeatedly calling lower(). - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The suggestion is technically correct - there are multiple calls to class_name.lower() which could be optimized. However, this is a minor performance optimization that would only save a few string operations. The current code is more readable with the inline .lower() calls. The performance impact would be negligible in the context of the larger operations this code is performing (tracing and instrumentation). The comment identifies a real optimization opportunity. In performance-critical code, reducing redundant string operations could be important. While technically correct, this optimization would be premature. The method is called during tracing/instrumentation where network and IO operations dominate performance. The readability benefit of inline .lower() outweighs the minor performance gain. Delete the comment. While technically correct, this optimization suggestion is too minor to be worth implementing, and the current code is more readable.
5. packages/opentelemetry-instrumentation-langchain/opentelemetry/instrumentation/langchain/callback_handler.py:463
- Draft comment:
Splitting the base_kind determination from the chain span type calculation in on_chain_start improves clarity. The updated logic cleanly distinguishes workflow and task spans. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
This comment is purely informative, explaining the changes made in the code without providing any actionable feedback or suggestions. It does not align with the rules for useful comments in a pull request review.
6. packages/opentelemetry-instrumentation-langchain/opentelemetry/instrumentation/langchain/callback_handler.py:787
- Draft comment:
The new on_retriever_start and on_retriever_end implementations correctly create and finalize retriever spans. Limiting output size in on_retriever_end is a good safeguard. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
This comment is purely informative, as it only describes what the new implementations do and praises a safeguard without suggesting any changes or asking for clarification. It doesn't provide any actionable feedback or raise any concerns.
7. packages/opentelemetry-instrumentation-langchain/tests/test_span_kinds.py:12
- Draft comment:
The tests in test_span_kinds.py provide comprehensive coverage for the new span kind functionality. Excellent job verifying various scenarios! - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
This comment is purely informative and praises the author for their work. It does not provide any actionable feedback or suggestions for improvement.
8. packages/opentelemetry-instrumentation-langchain/pyproject.toml:29
- Draft comment:
Using a local path for opentelemetry-semantic-conventions-ai in development is acceptable; remember to update this for release builds if required. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
This comment is purely informative and does not provide a specific code suggestion or request for confirmation. It simply reminds the author to update a local path for release builds, which is not actionable feedback.
9. packages/opentelemetry-semantic-conventions-ai/opentelemetry/semconv_ai/__init__.py:302
- Draft comment:
The expansion of TraceloopSpanKindValues with new span kinds (EMBEDDING, RETRIEVER, RERANKER, GENERATION) is implemented correctly. Verify that downstream consumers handle these new values as expected. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_Vy61rLVv3YBFyt8v
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
7e7fc67
to
e293136
Compare
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.
feat(instrumentation): ...
orfix(instrumentation): ...
.Implement #3384
Span generation conditions
EMBEDDING
OpenAIEmbeddings().embed_documents()
embedding
orembed
in nameRETRIEVER
retriever.invoke()
retriever
,retrieve
,search
in nameRERANKER
rerank
orreorder
in nameGENERATION
ChatOpenAI().invoke()
Important
Expands span kind functionality in Langchain instrumentation by adding new span kinds and updating callback handler logic.
EMBEDDING
,RETRIEVER
,RERANKER
, andGENERATION
toTraceloopSpanKindValues
insemconv_ai/__init__.py
.TraceloopCallbackHandler
incallback_handler.py
to determine span kinds using_determine_llm_span_kind()
and_determine_chain_span_kind()
.on_retriever_start()
andon_retriever_end()
incallback_handler.py
to handle retriever spans.test_span_kinds.py
to test span kind detection and creation for various models and chains.pyproject.toml
to use local path foropentelemetry-semantic-conventions-ai
dependency.This description was created by
for 7e7fc67. You can customize this summary. It will automatically update as commits are pushed.