Skip to content
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

fix(Haystack): Component Name retrieval #1291

Closed

Conversation

lambda-science
Copy link
Contributor

Haystack 2.10 Changed internal methods.
Openinference integration of Haystack is not compatible anymore.

File "/code/pythia_api/endpoints/chat.py", line 197, in _run_pipeline
2025-02-13T13:01:28.385766719Z     result = chat_pipeline.run({
2025-02-13T13:01:28.385770416Z              ^^^^^^^^^^^^^^^^^^^
2025-02-13T13:01:28.385774053Z   File "/code/.venv/lib/python3.12/site-packages/openinference/instrumentation/haystack/_wrappers.py", line 189, in __call__
2025-02-13T13:01:28.385777970Z     response = wrapped(*args, **kwargs)
2025-02-13T13:01:28.385782018Z                ^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13T13:01:28.385785715Z   File "/code/.venv/lib/python3.12/site-packages/haystack/core/pipeline/pipeline.py", line 248, in run
2025-02-13T13:01:28.385789592Z     component_outputs = self._run_component(component, inputs, component_visits, parent_span=span)
2025-02-13T13:01:28.385793259Z                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-13T13:01:28.385797017Z   File "/code/.venv/lib/python3.12/site-packages/openinference/instrumentation/haystack/_wrappers.py", line 73, in __call__
2025-02-13T13:01:28.385808388Z     component_name = pipe_args["name"]
2025-02-13T13:01:28.385812416Z                      ~~~~~~~~~^^^^^^^^
2025-02-13T13:01:28.385816894Z KeyError: 'name'

This MR tries to fix it with a few informations from Haystack maintainers. I'm not sure my MR fix the problems, I don't have so much time to test...

However Haystack Maintener pointed that OpenInference integration uses private methods which are subject to breaking change....
They said:

The more sustainable version would be to implement a proper custom tracing backend as outlined in our docs. The tracing backend is a public API which we try not to break. We really can't guarantee no changes to internal methods though. So moving to the tracing backend would prevent future breakage.

I think it should be re-factored

@lambda-science lambda-science requested a review from a team as a code owner February 17, 2025 13:20
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 17, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Feb 17, 2025
@lambda-science lambda-science changed the title Fix(Haystack): Component Name retrieval fix(Haystack): Component Name retrieval Feb 17, 2025
@lambda-science
Copy link
Contributor Author

Should update test to use haystack 2.10

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 18, 2025
@lambda-science
Copy link
Contributor Author

Well, it looks too broken for me to spend more time on this.
If you want to do a long term integratin that will not be subject to broken changes here is some info:
https://docs.haystack.deepset.ai/docs/tracing#custom-tracing-backend

Have a good day

Copy link

@jatingarg0908 jatingarg0908 left a comment

Choose a reason for hiding this comment

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

Hey also you have to make a deep copy for inputs . and then

@nate-mar
Copy link
Contributor

@lambda-science we appreciate you taking a pass on this!! I can pick up from here. Thanks again for the effort!

@axiomofjoy
Copy link
Contributor

Hey also you have to make a deep copy for inputs . and then

Thanks @jatingarg0908. I see what you mean now. The changes from 2.9 make this challenging. Probably going to try to directly instrument the component run method instead if I can.

@axiomofjoy
Copy link
Contributor

This issue should be resolved in openinference-instrumentation-haystack==0.1.18

@axiomofjoy
Copy link
Contributor

Closing this PR out, but thanks so much for your investigations @lambda-science @jatingarg0908 !

@axiomofjoy axiomofjoy closed this Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants