telemetry-dev-litellm 0.2.6__tar.gz → 0.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telemetry-dev-litellm
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: LiteLLM integration for telemetry.dev Python SDK
5
5
  Keywords: telemetry,opentelemetry,llm,genai,litellm,tracing
6
6
  Author: telemetry.dev
@@ -152,7 +152,7 @@ Aggregate usage keys are `input_tokens`, `output_tokens`, `total_tokens`, `cache
152
152
 
153
153
  ## Metadata
154
154
 
155
- On a LiteLLM or Router call made outside the LiteLLM proxy, each key of the call's `litellm_metadata` argument, or of `metadata` when `litellm_metadata` is absent or empty, is exported as `td.metadata.<key>`, except the keys listed below. That includes keys LiteLLM's Router adds to the argument, such as `model_group`, `deployment`, `model_info` and `api_base`. Rerank spans also add `result_count` and `search_units`.
155
+ On a LiteLLM or Router call made outside the LiteLLM proxy, each key of the call's `litellm_metadata` argument, or of `metadata` when `litellm_metadata` is absent or empty, is exported as `td.metadata.<key>`, except the keys listed below. That includes keys LiteLLM's Router adds to the argument, such as `model_group` and `deployment`, and the Router's additions to `tags`: the picked deployment's own tags and, for a deployment that uses a stored credential, `Credential: <name>`. Rerank spans also add `result_count` and `search_units`.
156
156
 
157
157
  Strings, numbers, booleans and non-empty sequences of only strings, only booleans or only numbers are exported as they are; other values, including empty sequences, are JSON-encoded. When `max_attribute_length` is set, each string, including each string in a sequence, and each JSON value is truncated to it; by default they are exported whole, or cut at 65,536 characters with `telemetry-dev` 0.3.2 or earlier. Metadata values are not passed to the `mask` callback, and metadata is exported whatever `capture_input` and `capture_output` are set to.
158
158
 
@@ -160,6 +160,7 @@ These top-level keys are always dropped:
160
160
 
161
161
  - `headers`, `requester_metadata`, `requester_ip_address`, `user_agent`, `endpoint`, `user_api_end_user_max_budget`, and every key that starts with `user_api_key`. LiteLLM's proxy stores the incoming request's headers, client IP address, user agent and URL under these names, along with the authenticated key, user, team and end user, including the user's email and JWT claims.
162
162
  - `previous_models`, where the Router keeps copies of the arguments and metadata of earlier failed calls on a retry or fallback.
163
+ - `model_info`, `api_base` and `kubernetes_pod_routing`, where the Router writes the deployment it picked: `model_info` holds any fields an admin configured for the deployment, an `api_base` URL can contain credentials, and `kubernetes_pod_routing` holds the internal service host and pod IP of a deployment found through Kubernetes pod discovery.
163
164
  - `userId`, `sessionId`, `user_id` and `session_id`, which the core SDK reserves. Use `propagate_attributes(user_id=..., session_id=...)` instead.
164
165
 
165
166
  Don't use these names for your own metadata. Other keys, including nested values, are exported as they are, so don't put credentials or personal data in metadata.
@@ -169,7 +170,7 @@ Don't use these names for your own metadata. Other keys, including nested values
169
170
  When LiteLLM's proxy server handles a request, the call it makes through its Router carries a `proxy_server_request` argument. For every call with that argument, the integration reads metadata differently. The proxy and its guardrails and hooks write their own data into both metadata arguments, such as the request's headers, the authenticated key and user, or Presidio's `pii_tokens`. So only part of one argument is read: `litellm_metadata` for Responses calls, and `metadata` for chat, embedding and rerank calls. These are the arguments the proxy and Router write into for those calls. Two parts of it are exported:
170
171
 
171
172
  - `requester_metadata`, the proxy's copy of the request body's `metadata` object. The proxy takes this copy before its guardrails and hooks run, but after authentication and request preparation have added data to the body's metadata, such as the `x-litellm-tags` header and the key's tags. So these keys of the copy are not exported, even when the client sent them in the body: `tags`, `spend_logs_metadata`, `agent_id`, `trace_id`, `session_id`, `used_client_oauth_token` and `litellm_session_id_omitted`, plus the keys dropped for every call listed above. If the body has no `metadata` object, nothing from `requester_metadata` is exported.
172
- - The Router's `model_group`, `model_group_alias`, `model_group_size`, `deployment`, `deployment_model_name`, `attempted_retries` and `max_retries`, when that argument holds a string, number or boolean under them. Objects, lists and `null` under these names are not exported. The Router's `model_info` and `api_base` are not exported, because `model_info` holds any fields an admin configured for the deployment and an `api_base` URL can contain credentials.
173
+ - The Router's `model_group`, `model_group_alias`, `model_group_size`, `deployment`, `deployment_model_name`, `attempted_retries` and `max_retries`, when that argument holds a string, number or boolean under them. Objects, lists and `null` under these names are not exported.
173
174
 
174
175
  Anything else is not exported, including keys the client sends in the body's `litellm_metadata`. Some limits remain:
175
176
 
@@ -128,7 +128,7 @@ Aggregate usage keys are `input_tokens`, `output_tokens`, `total_tokens`, `cache
128
128
 
129
129
  ## Metadata
130
130
 
131
- On a LiteLLM or Router call made outside the LiteLLM proxy, each key of the call's `litellm_metadata` argument, or of `metadata` when `litellm_metadata` is absent or empty, is exported as `td.metadata.<key>`, except the keys listed below. That includes keys LiteLLM's Router adds to the argument, such as `model_group`, `deployment`, `model_info` and `api_base`. Rerank spans also add `result_count` and `search_units`.
131
+ On a LiteLLM or Router call made outside the LiteLLM proxy, each key of the call's `litellm_metadata` argument, or of `metadata` when `litellm_metadata` is absent or empty, is exported as `td.metadata.<key>`, except the keys listed below. That includes keys LiteLLM's Router adds to the argument, such as `model_group` and `deployment`, and the Router's additions to `tags`: the picked deployment's own tags and, for a deployment that uses a stored credential, `Credential: <name>`. Rerank spans also add `result_count` and `search_units`.
132
132
 
133
133
  Strings, numbers, booleans and non-empty sequences of only strings, only booleans or only numbers are exported as they are; other values, including empty sequences, are JSON-encoded. When `max_attribute_length` is set, each string, including each string in a sequence, and each JSON value is truncated to it; by default they are exported whole, or cut at 65,536 characters with `telemetry-dev` 0.3.2 or earlier. Metadata values are not passed to the `mask` callback, and metadata is exported whatever `capture_input` and `capture_output` are set to.
134
134
 
@@ -136,6 +136,7 @@ These top-level keys are always dropped:
136
136
 
137
137
  - `headers`, `requester_metadata`, `requester_ip_address`, `user_agent`, `endpoint`, `user_api_end_user_max_budget`, and every key that starts with `user_api_key`. LiteLLM's proxy stores the incoming request's headers, client IP address, user agent and URL under these names, along with the authenticated key, user, team and end user, including the user's email and JWT claims.
138
138
  - `previous_models`, where the Router keeps copies of the arguments and metadata of earlier failed calls on a retry or fallback.
139
+ - `model_info`, `api_base` and `kubernetes_pod_routing`, where the Router writes the deployment it picked: `model_info` holds any fields an admin configured for the deployment, an `api_base` URL can contain credentials, and `kubernetes_pod_routing` holds the internal service host and pod IP of a deployment found through Kubernetes pod discovery.
139
140
  - `userId`, `sessionId`, `user_id` and `session_id`, which the core SDK reserves. Use `propagate_attributes(user_id=..., session_id=...)` instead.
140
141
 
141
142
  Don't use these names for your own metadata. Other keys, including nested values, are exported as they are, so don't put credentials or personal data in metadata.
@@ -145,7 +146,7 @@ Don't use these names for your own metadata. Other keys, including nested values
145
146
  When LiteLLM's proxy server handles a request, the call it makes through its Router carries a `proxy_server_request` argument. For every call with that argument, the integration reads metadata differently. The proxy and its guardrails and hooks write their own data into both metadata arguments, such as the request's headers, the authenticated key and user, or Presidio's `pii_tokens`. So only part of one argument is read: `litellm_metadata` for Responses calls, and `metadata` for chat, embedding and rerank calls. These are the arguments the proxy and Router write into for those calls. Two parts of it are exported:
146
147
 
147
148
  - `requester_metadata`, the proxy's copy of the request body's `metadata` object. The proxy takes this copy before its guardrails and hooks run, but after authentication and request preparation have added data to the body's metadata, such as the `x-litellm-tags` header and the key's tags. So these keys of the copy are not exported, even when the client sent them in the body: `tags`, `spend_logs_metadata`, `agent_id`, `trace_id`, `session_id`, `used_client_oauth_token` and `litellm_session_id_omitted`, plus the keys dropped for every call listed above. If the body has no `metadata` object, nothing from `requester_metadata` is exported.
148
- - The Router's `model_group`, `model_group_alias`, `model_group_size`, `deployment`, `deployment_model_name`, `attempted_retries` and `max_retries`, when that argument holds a string, number or boolean under them. Objects, lists and `null` under these names are not exported. The Router's `model_info` and `api_base` are not exported, because `model_info` holds any fields an admin configured for the deployment and an `api_base` URL can contain credentials.
149
+ - The Router's `model_group`, `model_group_alias`, `model_group_size`, `deployment`, `deployment_model_name`, `attempted_retries` and `max_retries`, when that argument holds a string, number or boolean under them. Objects, lists and `null` under these names are not exported.
149
150
 
150
151
  Anything else is not exported, including keys the client sends in the body's `litellm_metadata`. Some limits remain:
151
152
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telemetry-dev-litellm"
3
- version = "0.2.6"
3
+ version = "0.2.7"
4
4
  description = "LiteLLM integration for telemetry.dev Python SDK"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telemetry-dev-litellm"
3
- version = "0.2.6"
3
+ version = "0.2.7"
4
4
  description = "LiteLLM integration for telemetry.dev Python SDK"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -17,7 +17,7 @@ import litellm
17
17
  import telemetry_dev
18
18
  from opentelemetry import trace
19
19
 
20
- __version__ = "0.2.6"
20
+ __version__ = "0.2.7"
21
21
 
22
22
  RequestMapper = Callable[[tuple[Any, ...], Mapping[str, Any]], tuple[str, dict[str, Any]]]
23
23
  ResponseMapper = Callable[[Any], dict[str, Any]]
@@ -403,11 +403,14 @@ _PROXY_REQUEST_METADATA_KEYS = frozenset(
403
403
  }
404
404
  )
405
405
  _PROXY_AUTH_METADATA_PREFIX = "user_api_key"
406
+ # Keys the Router writes into the caller's metadata argument for the deployment it picked,
407
+ # dropped on every call: model_info holds whatever fields an admin configured for the
408
+ # deployment, an api_base URL can carry credentials, and kubernetes_pod_routing (LiteLLM 1.110
409
+ # and later) holds the internal service host and pod IP of a pod-discovered deployment.
410
+ _ROUTER_DEPLOYMENT_METADATA_KEYS = frozenset({"model_info", "api_base", "kubernetes_pod_routing"})
406
411
 
407
412
  # Keys the Router writes into the metadata argument when it picks a deployment and retries,
408
413
  # exported on the proxy only with a scalar value, since a hook can write anything under them.
409
- # model_info and api_base are left out: model_info holds whatever fields an admin configured
410
- # for the deployment, and an api_base URL can carry credentials.
411
414
  _PROXY_ROUTER_METADATA_KEYS = (
412
415
  "model_group",
413
416
  "model_group_alias",
@@ -452,6 +455,7 @@ def _request_metadata(
452
455
  key: value
453
456
  for key, value in metadata.items()
454
457
  if str(key) not in _PROXY_REQUEST_METADATA_KEYS
458
+ and str(key) not in _ROUTER_DEPLOYMENT_METADATA_KEYS
455
459
  and not str(key).startswith(_PROXY_AUTH_METADATA_PREFIX)
456
460
  }
457
461