Repository navigation
fix(sdk-litellm): keep the router's deployment config out of span metadata - #230
Merged
Merged
Conversation
…adata LiteLLM's Router writes the deployment it picked into the caller's own metadata argument. On calls made outside the LiteLLM proxy, every key of that argument was exported, so spans carried td.metadata.api_base, whose URL can hold credentials, and td.metadata.model_info, which holds any fields an admin configured for the deployment. LiteLLM 1.110 also writes kubernetes_pod_routing, with the internal service host and pod IP of a pod-discovered deployment. These three keys are now dropped on every call, as the proxy path already did for api_base and model_info.
Merged
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.
LiteLLM's Router writes the deployment it picked into the caller's own
metadataargument. On calls made outside the LiteLLM proxy, the integration exports every key of that argument, so a Router call's span carriedtd.metadata.api_base, whose URL can hold credentials (https://user:secret@host/v1), andtd.metadata.model_info, which holds any fields an admin configured for the deployment. The proxy path already left both out. LiteLLM 1.110 also writeskubernetes_pod_routing, with the internal service host and pod IP of a deployment found through Kubernetes pod discovery.These three keys are now dropped on every call. This also drops a caller's own metadata under those names. LiteLLM itself reads
metadata.model_infoandmetadata.api_base, so they aren't usable as user keys anyway. The README lists them with the other dropped keys, and says that the Router's additions totagsinclude the deployment's tags andCredential: <name>, which stay exported.The Router owner test now routes to a deployment with a credentialed
api_baseand amodel_info, and passes akubernetes_pod_routingvalue. One proxy case sends the same names in the request body's metadata.Tests: the package's pytest suite against LiteLLM 1.90.2 (lowest) and 1.110.2 (highest). At 1.110.2, two unrelated tests fail on main until #229 merges. With #229 applied, all tests pass at both bounds.