Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(llama-index): use the correct instrumentation point #2807

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

Conversation

thisthat
Copy link
Contributor

@thisthat thisthat commented Apr 8, 2025

Fixes #2799

  • I have added tests that cover my changes.
  • If adding a new instrumentation or changing an existing one, I've added screenshots from some observability platform showing the change.
  • PR name follows conventional commits format: feat(instrumentation): ... or fix(instrumentation): ....
  • (If applicable) I have updated the documentation accordingly.

The instrumentation only attaches to *.core packages. Therefore, it should be the dependency used to decide if the instrumentation is triggered.

image

@thisthat thisthat marked this pull request as ready for review April 8, 2025 08:42
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 56144b6 in 1 minute and 3 seconds

More details
  • Looked at 22 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. packages/opentelemetry-instrumentation-llamaindex/opentelemetry/instrumentation/llamaindex/__init__.py:41
  • Draft comment:
    Ensure the dependency change to 'llama-index-core' aligns with SDK requirements. This update is critical as it triggers instrumentation only when the core package is present.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 20% <= threshold 50%
    The comment is related to a dependency change, specifically mentioning llama-index-core. It suggests ensuring alignment with SDK requirements, which is a general cautionary note. The comment does not provide a specific code suggestion or identify a specific issue with the change. It seems to be more of a reminder or caution, which violates the rule against making purely informative comments.
2. packages/opentelemetry-instrumentation-llamaindex/opentelemetry/instrumentation/llamaindex/__init__.py:58
  • Draft comment:
    Verify that checking version for 'llama-index-core' is intended. The updated condition ensures the dispatcher instrumentation is used only for core versions >= 0.10.20.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 30% <= threshold 50%
    The comment is asking the PR author to verify their intention regarding a version check for llama-index-core. This falls under the rule of not asking the author to confirm their intention. However, it does provide specific information about the condition change, which could be useful if it were rephrased as a suggestion or observation rather than a request for verification.
3. packages/opentelemetry-instrumentation-llamaindex/opentelemetry/instrumentation/llamaindex/__init__.py:41
  • Draft comment:
    Updated the dependency from 'llama-index' to 'llama-index-core' so that instrumentation depends on the correct package. Ensure that this matches the installed package and its versioning.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is related to a dependency change, which is not allowed according to the rules. The comment asks the author to ensure that the dependency matches the installed package and its versioning, which is not specific enough to be useful. Therefore, this comment should be removed.
4. packages/opentelemetry-instrumentation-llamaindex/opentelemetry/instrumentation/llamaindex/__init__.py:58
  • Draft comment:
    Switched the version check to use 'llama-index-core' so that it uses the correct package version for instrumentation. Verify that the version semantics on 'llama-index-core' align as expected.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the PR author to verify the version semantics, which is against the rules. It does not provide a specific suggestion or point out a specific issue with the code. Therefore, it should be removed.

Workflow ID: wflow_Yf0i2zWUkQ1IbdmI


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Member

@nirga nirga left a comment

Choose a reason for hiding this comment

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

Thanks @thisthat! The only issue is that this package didn't exist in the past - so I wonder if we should make this change (which means we won't be backward compatible anymore)

@thisthat
Copy link
Contributor Author

thisthat commented Apr 9, 2025

Another possibility would be to create two Instruments: llamaindex-legacy and llamaindex that only differ on the pkg used to decide if the instrumentation should be kicking in.
The current LlamaIndexInstrumentor class would then override the instrument/uninstrument methods delegating them to its two sub-instruments. WDYT @nirga?
Based on the agreement on this, I would apply the same strategy for PineCone since I noticed a similar problem with pinecone-client being deprecated in favor of pinecone (see docs here).

@nirga
Copy link
Member

nirga commented Apr 11, 2025

Sounds like a great plan actually!

@thisthat thisthat force-pushed the llamaindex-use-core-pkg-for-instrumentation-point branch from e074ef4 to 1371782 Compare April 15, 2025 07:47
@thisthat
Copy link
Contributor Author

Hey @nirga 👋 I've implemented what we discussed :) the PR is ready for another round of review

@nirga nirga merged commit 4abc689 into traceloop:main Apr 17, 2025
9 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.

🐛 Bug Report: LlamaIndex Instrumentation doesn't come through
2 participants