Fix instrumentation support for OpenAI client 0.14+#531
Merged
Conversation
SylvainJuge
reviewed
Feb 5, 2025
| id("elastic-otel.instrumentation-conventions") | ||
| } | ||
|
|
||
| val openAiVersion = "0.13.0"; // DO NOT UPGRADE |
Member
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
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
SylvainJuge
approved these changes
Feb 5, 2025
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
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.
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
ApiAdapterand 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
ApiAdapterImpls and will therefore ensure that future breaking changes to those are correctly detected. That's why I went for two instrumentation modules here.