[WIP] feat: added telemetry for pinecone DB#39
Conversation
|
|
Thanks @kartikay-bagla |
|
One comment about the test - I'd test it similarly to how we did it in Python (i.e. - instead of made-up vectors). |
I thought since we're specifically testing the tracing with pinecone, it would be better to reduce dependency on other things. |
Yeah that also makes sense so I'm fine with that. There's always the tension between writing integration tests and unit tests. We chose the integration test path since they catch more bugs easily (specifically in the LLM domain where the library maintainers have a tendency to break APIs all the time), but they are harder to run locally and in CI. BTW we have an effort on the Python SDK to instrument the vectors themselves so might worth doing it here as well. |
I'm sorry but I'm not exactly clear on what "instrumenting the vectors" mean. Also, I was able to get the unit tests working :) |
| provider.addSpanProcessor(new SimpleSpanProcessor(memoryExporter)); | ||
| instrumentation = new PineconeInstrumentation(); | ||
| instrumentation.setTracerProvider(provider); | ||
| instrumentation.manuallyInstrument(pc_module); |
There was a problem hiding this comment.
@nirga I'm not sure why but I need to call manuallyInstrument because otherwise the wrappers are not working. Could you help me debug this?
To replicate this, you can comment out line 42 here and try running the tests.
There was a problem hiding this comment.
@kartikay-bagla you need to initialize the instrumentation in the SDK, here
There was a problem hiding this comment.
And it still doesn't work for you without manually instrument?
There was a problem hiding this comment.
yep, I need to call it manually (while running the sample app or the tests).
Check out this PR. Basically it's sending as span events the vectors you get in response when calling Pinecone's query method. |
|
@nirga I have added span events as well!. |
|
Thanks @kartikay-bagla! Let me know when it's ready for review and I'll do a full check up :) |
@nirga apart from needing to call |
|
@kartikay-bagla I suspect that the auto-instrumentation is not working well since it can't find the module automatically. We encountered some similar issues in the langchain instrumentation, see the solution @Kartik1397 came up with there - |
I think that fixes it! Sample app is now working as well! @nirga you can do a full review now. |
|
Looks good overall @kartikay-bagla! Can we just align the semantic conventions to the ones we have in Python, and add them to the Also, I see the test is failing with 404... Does it also happen to you locally? |
The 404 could happen due to a missing API key for pinecone. You need to add it to the environment as |
|
The API key was there, the problem was with the configuration we had in Pinecone :/ (BTW the build and test here fails automatically on your commits due to some Github limitation that doesn't allow outside contributors to use our secrets for running the tests and I'm triggering it manually everytime. So it should pass if the tests work and I trigger them). |
|
Fixed package.json issue. And I have attributed the test error to just not waiting long enough for pinecone to update. I tried running the tests locally about 100 times, it sometimes failed like yours did. Added a 30 second wait time before querying any freshly inserted datam and that seemed to fix the issue! |
|
🧚 @kartikay-bagla congratulations for completing Quest #32 💰 A reward of $100 has been credited to you. To claim your $100 reward follow the instructions here. Questions? Check out the docs. |
Co-authored-by: Nir Gazit <nirga@users.noreply.github.com>
Fixes #32.
This is my first foray into NodeJS and its ecosystem so I'm a little unsure about a couple of things:
How do I run tests?How do I run the sample app to check if everything is looking good?Sample app is working now :)I have marked a few places in the code where I'm unsure if I need to change code@quest-bot loot #32