Skip to content

fix(watsonx): use configured API endpoint - #4382

Draft
LuisFigueroaG wants to merge 1 commit into
traceloop:mainfrom
LuisFigueroaG:agent/issue-2163-watsonx-endpoint
Draft

fix(watsonx): use configured API endpoint#4382
LuisFigueroaG wants to merge 1 commit into
traceloop:mainfrom
LuisFigueroaG:agent/issue-2163-watsonx-endpoint

Conversation

@LuisFigueroaG

Copy link
Copy Markdown

Summary

  • record the Watsonx API endpoint configured by the caller instead of reporting the us-south endpoint for every request
  • support both current credentials.url objects and legacy wml_credentials["url"] mappings
  • omit watsonx.api_base when the SDK does not expose a trustworthy endpoint
  • keep instrumentation non-intrusive when optional SDK properties are missing or raise during access

Root cause

The instrumentation always set watsonx.api_base to https://us-south.ml.cloud.ibm.com, regardless of the region or custom/on-prem endpoint used by the Watsonx client.

There was also a signature mismatch in the input handler: _handle_input declared an unused response_counter parameter, while its caller did not provide one. The instrumentation's defensive decorator swallowed that TypeError, preventing API and other input attributes from being recorded. Removing the unused parameter makes the endpoint resolution effective.

The endpoint is now resolved from explicit constructor credentials or API clients first, then from the current and legacy client shapes available on the model instance. If none provides a valid URL, no API base attribute is emitted rather than reporting incorrect telemetry.

Validation

  • full Watsonx test suite: 20 passed
  • focused endpoint tests: 12 passed
  • Ruff lint: passed
  • Python compile check: passed
  • diff whitespace check: passed

Closes #2163

@CLAassistant

CLAassistant commented Jul 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2731d9ec-01c2-4845-b4d0-4c1cbf43af2d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

🐛 Bug Report: Watsonx hardcoded values

2 participants