-
Notifications
You must be signed in to change notification settings - Fork 17
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 instrumentation support for OpenAI client 0.14+ #531
Conversation
.../common/src/main/java/co/elastic/otel/openai/wrappers/InstrumentedChatCompletionService.java
Outdated
Show resolved
Hide resolved
id("elastic-otel.instrumentation-conventions") | ||
} | ||
|
||
val openAiVersion = "0.13.0"; // DO NOT UPGRADE |
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.
Is it something that renovate/dependabot would attempt to upgrade ? If so I think there are ways like splitting the string in parts to prevent this.
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.
Good idea. I don't know if renovate is smart enough for this. We can just keep it like this for now and see if renovate detects it and attempts an upgrade
The OpenAI java client 0.14 had several breaking changes due to some methods we used being renamed.
The other logic is still all the same, that's why I decided to simply encapsulate those methods in an
ApiAdapter
and provide implementations for each the pre and post 0.14.0 versions.For on how to install the instrumentation I considered two alternatives:
While the second option introduces slightly more code, it has the benefit of muzzle working correctly: For each module, muzzle will pick up the OpenAI client methods used in the
ApiAdapterImpl
s and will therefore ensure that future breaking changes to those are correctly detected. That's why I went for two instrumentation modules here.