Repository navigation
fix: land the 2026-11-16 GenAI semconv sweep and sync rius-semconv v1.13.0 - #289
Conversation
…kip unnamed tool calls
A function tool is now recorded as {type: function, name, description,
parameters}: OpenAI's nested function is lifted, Anthropic's input_schema
(and the legacy functions entries) become function tools with parameters.
A provider's built-in tool keeps its fields, with its type prefixed by the
provider name. Applied on set_tool_definitions and on the definitions the
normalizer reassembles from OpenInference and the request bag.
A tool call with no string name is skipped rather than written with
name: null, which the conventions' schema rejects.
…e CHAIN kind (RIUS-1877)
The GenAI conventions added framework-entrypoint operations (invoke_runner,
and invoke_{framework_entrypoint} in general) and define an entrypoint as not
being an agent. kind_for_operation knew none of them, so a native runner span
got no openinference.span.kind.
The vendored kind-by-operation table gains invoke_runner from rius-semconv,
and kind_for_operation maps any other invoke_ operation the table does not
list to CHAIN. invoke_agent stays AGENT and invoke_workflow stays CHAIN.
The GenAI conventions now ask for gen_ai.input.messages, gen_ai.output.messages, gen_ai.system_instructions and gen_ai.tool.definitions as maps and arrays, which OpenTelemetry Python keeps on spans from 1.45. Every export pass read only strings, so a structured value skipped the media rebuild and its blob bytes could reach the backend. The exporter now writes such a value as its JSON text first, in the one encoding and uncut, and normalizes it exactly as that string. A blob part's byte content is written as its base64, so the part keeps its byte_size and loses its bytes; any other byte object is the marker.
…TURE_CONTENT is unset NO_CONTENT and EVENT_ONLY turn content capture off (content is recorded on spans only), SPAN_ONLY and SPAN_AND_EVENT keep it on. Read case-insensitively; an unrecognised value keeps the default (on) and warns. The explicit option and RIUS_CAPTURE_CONTENT keep precedence, and with neither variable set capture stays on.
…lacement A native blob part whose content is a complete replacement now takes byte_size from it, and its mime when the part has no valid mime_type, per the rius-semconv media contract. The serializer strips a blob's base64 content to a replacement before the exporter rebuilds the part, so a blob set through the SDK's own setters lost its byte_size; bytes and base64 now store alike.
…ncoded A blob part's bytes were written as base64 before encoding. When the encoder then refused the value (a cycle, a bytes or tuple key), the fallback was the repr of that converted value, where the base64 is a bare string the media rebuild and the strip do not read, so the image was exported. The base64 form is now kept only when the whole value encodes; otherwise the fallback is the text of the value as it came, whose byte objects are markers. Re-vendor sdk_cases with the lone byte object, float, data URL and nested blob cases.
…mini tool definitions A tool call without a name is written as a text part holding its id and arguments instead of being dropped, on every path that writes tool_call parts. Bedrock toolSpec definitions become function tools, and Gemini function declarations expand to one function tool each.
…id OTel values An empty RIUS_CAPTURE_CONTENT no longer shadows OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT (it still warns, as the other blank RIUS_* flags do), and an empty OTel variable counts as unset. The warning for an unrecognised OTel value says capture stays on and lists the valid values.
int() refuses a string over 4300 digits, leading zeros included, and is_replacement now parses the size. The strip calls it on sibling strings inside the export chain, so a replacement with a long digit run in a message, an output or a mime key raised ValueError and the whole batch was dropped. Drop leading zeros first, and treat a run with more significant digits than 2^53 - 1 has as an unknown size without converting it. Re-vendor the contract, whose new examples pin 5000 zeros then 8 (byte_size 8), 5000 nines and a size past int64 (no byte_size).
Every Gemini declarations spelling that holds a list expands, a declaration's schema is renamed from any spelling, and nameless declarations and the rest of a Gemini tool take the single-tool rule, so rewriting an output changes nothing. A nested function is lifted only without a top-level name, a null parameters gives way to another schema spelling, and an empty type gets no prefix. An MCP tool's headers are dropped, since they can carry credentials. Definitions that come to an empty list write nothing, as the sink does, and set_tool_definitions records a pydantic tool as its set fields. The shared rius-semconv tool_definitions cases are vendored and run.
…reat an empty tool name as none OpenAI's MCP tool carries authorization, an OAuth access token, beside headers: both go for mcp and any <provider>.mcp type, read from the type the tool is written with so a second pass drops the same members. A Chat Completions custom tool's nested fields are lifted by the function rule and it stays a custom tool. An empty name no longer makes a function tool. Only google-genai's pydantic models are dumped; other pydantic tools are recorded as before. Shared cases re-vendored from rius-semconv#117.
The AI SDK's openai.mcp provider tool holds authorization and headers in args. A tool written as mcp or <provider>.mcp now loses them there as well as at the top level. Shared cases re-vendored from rius-semconv#117.
…ts-chain' into pablo/semconv-sweep-2026-11-16
…nt-attributes' into pablo/semconv-sweep-2026-11-16
…e-size' into pablo/semconv-sweep-2026-11-16 # Conflicts: # tests/conformance/_recording.py # tests/conformance/_replay.py # tests/fixtures/semconv/SOURCE
…initions' into pablo/semconv-sweep-2026-11-16 # Conflicts: # tests/test_sdk_cases.py
…tent-env' into pablo/semconv-sweep-2026-11-16
Re-pins the vendored constants module from v1.10.0 to v1.13.0, which also brings in the v1.11.0 hint-delivery keys and the v1.12.0 compaction operation constant, and re-syncs the shared recordings, sdk_cases and replay helpers at the v1.13.0 commit. The compaction span's operation name now comes from the generated constant instead of a local literal.
Automated reviewNo blocking issues. One interaction between #285 and #288 is worth fixing, either here or as a fast follow-up. What I checked
Should fixA structured blob over about 768 KB loses the whole attribute (
The result is a truncated string. The size and MIME type are lost, and every other part of the message is cut off along with them. Reproduced on this branch with one user message, a text part and an 800 KB PNG A single phone photo is larger than this, so vision calls from an instrumentation that sets structured content will hit it. The same happens when the blob is already a base64 string in a structured value. The JSON-string form of that same value, however, exports a correct stripped blob part ( #288 makes a cheap fix possible. For the base64-string case, the structured path would also need to skip the strip budget (encode whole, as the string path effectively does). The value is already fully in memory on the span either way. Worth checking whether the TS SDK has the same budget cut on its structured path. Nits
What's good
|
A blob part's byte content in a structured content value is written as the strip replacement ([stripped <mime> <len> bytes]) instead of its base64, and the structured value is encoded whole rather than cut at the strip budget. An 800 KB image no longer turns the attribute into a cut, non-JSON string that loses its size, MIME type and every other part, and a base64 string in a structured value exports exactly as the JSON text of the same value.
|
Fixed the large structured blob finding in 090b0c9.
|
Automated reviewScope: 090b0c9 (parent 474962f), the fix for a structured blob over ~768 KB losing the whole attribute. Verdict: no blocking issues. The fix is correct. One resource regression is worth a decision before merge (see the first item). What I checked
🟡 Suggestions1. The structured path is no longer bounded: escape-heavy values now cost about 70x their size in memory on the export thread. This happens at Why: Before this change, a structured value stopped rendering at 1 MiB and never reached the rebuild walk. Now the whole text goes to
Time is linear at about 0.12 s per MB. Values with no escapes are fine (20 MB plain text: 0.12 s, about 45 MB). That 2 GB is enough to OOM-kill a typical container from inside the exporter. This is not new code: a JSON string attribute of the same size already costs the same today (4.17 s and 2540 MB on 474962f), and TS behaves similarly (2.3 s and 1.5 GB RSS). So the commit makes the structured path match the string path, as it intends, but it also removes a bound the structured path used to have. Suggestion (any one of these):
I'd go with (a) or (c). 2. Test gap: no test covers the newly unbounded path when there is no blob. This is in The new tests cover the blob (bytes and base64), but nothing pins that a structured value past
💭 Nits
Good call writing the bytes straight to the replacement instead of base64: it removes the render cost of the blob entirely, and the parity tests against the JSON text of the base64 form are exactly the right oracle. |
Lands the five reviewed PRs of the 2026-11-16 GenAI semconv sweep together and re-pins rius-semconv to v1.13.0. Each PR vendored only its own slice of rius-semconv, so none could re-pin alone. Each branch is merged in with
--no-ff, so its commits are kept.Integrated PRs
invoke_runnerand the other framework entrypoint operations map to the CHAIN kind.gen_ai.input.messages,gen_ai.output.messages,gen_ai.system_instructions,gen_ai.tool.definitions) that another instrumentation set as maps or arrays are exported as their compact JSON and normalized like a string.OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENTis honoured whenRIUS_CAPTURE_CONTENTis unset.rius-semconv v1.13.0
_semconv_generated.pyre-vendored withTAG=v1.13.0 scripts/sync-semconv.sh(was v1.10.0).sdk_cases,media_parts.yaml,usage_keys.yamland the replay helpers re-synced withscripts/sync-semconv-fixtures.shat the v1.13.0 commit (a580857).rius.hint.*keys and therius.hint.deliveredevent. They are new constants only, and nothing in this SDK emits them yet.GEN_AI_OPERATION_NAME_COMPACTION.rius.compaction.OPERATION_COMPACTIONnow takes its value from that constant instead of a local literal. Same value, same public name.known_differences.json: the 12gen_ai.tool.definitionsentries stay. The v1.13.0 expected results still hold the provider-shaped tool definitions (OpenAI's nestedfunction, Anthropic'sinput_schema), so this normalizer's conventions-shaped output still differs from them. They go once rius-semconv regenerates those expected results.Closes RIUS-1874
Closes RIUS-1875
Closes RIUS-1877
Closes RIUS-1879
Closes RIUS-1883
BEGIN_COMMIT_OVERRIDE
feat: map invoke_runner and other framework entrypoint operations to the CHAIN kind
fix: accept structured content attributes from third-party spans
fix: size a blob whose content is a complete strip replacement from that replacement
fix: record tool definitions in the conventions' function-tool shape
fix: write a tool call without a name as a text part instead of an invalid tool-call part
fix: drop MCP credentials from recorded tool definitions
feat: honour OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT when RIUS_CAPTURE_CONTENT is unset
fix: sync rius-semconv v1.13.0
END_COMMIT_OVERRIDE