Skip to content

feat(python): trace IBM watsonx.ai and Writer, zero-code - #728

Merged
nik13 merged 8 commits into
devfrom
feat/python-watsonx-writer-1119
Nov 19, 2026
Merged

nik13 merged 8 commits into
devfrom
feat/python-watsonx-writer-1119

Conversation

@nik13

@nik13 nik13 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

What

Two new Python integrations, both registered in zero-code auto-instrumentation (fi-instrument / FI_AUTO_INSTRUMENT=true picks each up when its SDK is installed).

traceAI-watsonx (IBM watsonx.ai, ibm-watsonx-ai >=1.3.0,<2)

  • ModelInference generate, generate_text, generate_text_stream, chat, chat_stream and their async forms, plus Embeddings. Only the outermost call gets a span; usage, finish reason and model from inner calls (e.g. generate_text → generate) are folded into it.
  • Request parameters from the model object and the call; prompt_variables are recorded as template variables, which the input-hiding settings mask. input.value/output.value and messages follow the hide settings. Embedding vectors and exception messages are never exported.
  • Tracing failures never break the user's call. Streams end exactly once; batched async_mode prompts are recorded per prompt with summed usage.

traceAI-writer (Writer, writer-sdk >=2.0.0,<4)

  • chat.chat and completions.create (sync and async, streaming), including tool calls and streamed tool-call deltas. chat.stream(), with_raw_response and with_streaming_response each produce exactly one span.
  • A chat.stream() helper left early, closed or dropped still ends its span (marked incomplete).
  • Content follows the hide settings; errors record only error.type.

Release wiring for both: release-please config and manifest (0.1.0), the PyPI bootstrap list, the auto-instrumentation registry, CI workflows (oldest SDK on Python 3.10, latest on 3.13, offline), and the docs tables.

Tests

Offline, real SDKs with HTTP stubbed and sockets blocked.

  • watsonx: 32 passed on Python 3.10 and 3.12, SDK 1.3.0 to 1.9.1.
  • writer: 35 passed at writer-sdk 3.0.0; 30 passed + 5 skipped at 2.0.0, where the chat.stream helper does not exist.
  • Auto-instrumentation tests: 393 passed.

…ro-code registration

Add traceAI-watsonx (traceai_watsonx.WatsonxInstrumentor) for ibm-watsonx-ai 1.3.0 up to 2.0:
ModelInference generate/generate_text/generate_text_stream/chat/chat_stream and their async
variants, and Embeddings generate/embed_documents/embed_query and async variants. Register
the integration for zero-code instrumentation and wire release automation, CI and docs.
…late variables, input/output values and tracing failures
…eep template variables out of request parameters, set input/output values, guard tracing failures

- generate_text, embed_query and embed_documents take usage, finish reason and response model from the inner generate response through the outer span's accumulator.
- Parameters given when creating ModelInference or Embeddings are recorded under the call's.
- prompt_variables move to gen_ai.prompt.template.variables, which core hides with the input flags.
- input.value, input.mime_type and output.value follow the sibling providers and the hide settings.
- A tracing error in span start or result handling never breaks a successful call.
- generate(prompt=[...], async_mode=True) records each answer under its own prompt and sums usage.
…ams; register zero-code auto-instrumentation
@nik13
nik13 merged commit 1cd9f2e into dev Nov 19, 2026
210 checks passed
@nik13
nik13 deleted the feat/python-watsonx-writer-1119 branch November 19, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant