feat(otel): map the oci provider to gen_ai.provider.name=oracle_cloud.generative_ai

OCI Generative AI calls currently reach OpenTelemetry backends with the
raw litellm provider string "oci" as gen_ai.provider.name. Map it to
oracle_cloud.generative_ai, the well-known value proposed in
open-telemetry/semantic-conventions-genai#526, so OCI traffic groups
with the other cloud providers instead of landing in a vendor bucket.

Spans derive both gen_ai.provider.name and the deprecated gen_ai.system
from the resolved provider, so both carry the mapped value; metric
labels keep dual-emitting the raw string on gen_ai.system as before.
This commit is contained in:
Federico Kamelhar 2026-09-18 10:54:02 -04:00
parent 88ea40e69c
commit ca3addacc5
2 changed files with 3 additions and 0 deletions

View file

@ -68,6 +68,7 @@ class GenAIProvider(str, Enum):
PERPLEXITY = "perplexity"
X_AI = "x_ai"
IBM_WATSONX_AI = "ibm.watsonx.ai"
ORACLE_CLOUD_GENERATIVE_AI = "oracle_cloud.generative_ai"
class MCPMethod(str, Enum):
@ -390,6 +391,7 @@ _PROVIDER_BY_LITELLM: Final[dict[str, GenAIProvider]] = {
"perplexity": GenAIProvider.PERPLEXITY,
"xai": GenAIProvider.X_AI,
"watsonx": GenAIProvider.IBM_WATSONX_AI,
"oci": GenAIProvider.ORACLE_CLOUD_GENERATIVE_AI,
}
# litellm ``call_type`` -> ``gen_ai.operation.name``.

View file

@ -210,6 +210,7 @@ def test_provider_resolution():
assert resolve_provider("openai") == "openai"
assert resolve_provider("bedrock") == "aws.bedrock"
assert resolve_provider("vertex_ai") == "gcp.vertex_ai"
assert resolve_provider("oci") == "oracle_cloud.generative_ai"
# unknown providers pass through verbatim (semconv allows provider-specific)
assert resolve_provider("my_custom_llm") == "my_custom_llm"
assert resolve_provider(None) == ""