[PR #20765] Add support for W&B dedicated cloud instances in Weave tracing integration #29487

Closed
opened 2026-02-21 20:45:40 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/20765

State: closed
Merged: Yes


Fixes #20764

Summary

This PR adds support for Weights & Biases dedicated cloud instances in the Weave tracing integration. Enterprise customers often use dedicated W&B cloud deployments with custom endpoints, and the current implementation only supports the standard W&B cloud (wandb.ai).

Changes Made:

Backend Changes:

  • api/core/ops/entities/config_entity.py: Added optional host field to WeaveConfig class with proper validation to ensure URLs start with https:// or http://
  • api/core/ops/weave_trace/weave_trace.py:
    • Updated __init__ method to conditionally include host parameter in wandb.login() when provided
    • Updated api_check method to use host parameter for login verification
  • api/core/ops/ops_trace_manager.py: Added host to the other_keys list for proper configuration management

Frontend Changes:

  • web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type.ts: Added host: string field to WeaveConfig TypeScript interface
  • web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx:
    • Added host: '' to weaveConfigTemplate
    • Added Host input field to the Weave configuration form with appropriate placeholder text

Key Features:

  • Backward Compatible: Host field is optional, existing configurations continue to work with standard W&B cloud
  • Enterprise Ready: Enables connection to dedicated W&B cloud instances (e.g., https://api.wandb.ai)
  • Consistent UX: Follows the same pattern as other tracing providers (LangFuse, LangSmith, Opik) that support custom endpoints
  • Proper Validation: URL validation ensures host parameters are properly formatted

Technical Implementation:

The implementation leverages the W&B Python SDK's built-in support for the host parameter in wandb.login(). When a host is provided, it's included in the login call; otherwise, the SDK uses the default W&B cloud endpoint.

Screenshots

image
Weave config only supported standard W&B cloud

Screenshot 2025-06-06 at 5 48 51 PM Weave config now includes optional Host field for dedicated cloud instances

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • [] I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/20765 **State:** closed **Merged:** Yes --- Fixes #20764 ## Summary This PR adds support for Weights & Biases dedicated cloud instances in the Weave tracing integration. Enterprise customers often use dedicated W&B cloud deployments with custom endpoints, and the current implementation only supports the standard W&B cloud (wandb.ai). ### Changes Made: **Backend Changes:** - **`api/core/ops/entities/config_entity.py`**: Added optional `host` field to `WeaveConfig` class with proper validation to ensure URLs start with `https://` or `http://` - **`api/core/ops/weave_trace/weave_trace.py`**: - Updated `__init__` method to conditionally include `host` parameter in `wandb.login()` when provided - Updated `api_check` method to use host parameter for login verification - **`api/core/ops/ops_trace_manager.py`**: Added `host` to the `other_keys` list for proper configuration management **Frontend Changes:** - **`web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type.ts`**: Added `host: string` field to `WeaveConfig` TypeScript interface - **`web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx`**: - Added `host: ''` to `weaveConfigTemplate` - Added Host input field to the Weave configuration form with appropriate placeholder text ### Key Features: - **Backward Compatible**: Host field is optional, existing configurations continue to work with standard W&B cloud - **Enterprise Ready**: Enables connection to dedicated W&B cloud instances (e.g., `https://api.wandb.ai`) - **Consistent UX**: Follows the same pattern as other tracing providers (LangFuse, LangSmith, Opik) that support custom endpoints - **Proper Validation**: URL validation ensures host parameters are properly formatted ### Technical Implementation: The implementation leverages the W&B Python SDK's built-in support for the `host` parameter in `wandb.login()`. When a host is provided, it's included in the login call; otherwise, the SDK uses the default W&B cloud endpoint. ## Screenshots ![image](https://github.com/user-attachments/assets/1ecb3919-1453-45ff-9092-010617c18651) Weave config only supported standard W&B cloud <img width="1511" alt="Screenshot 2025-06-06 at 5 48 51 PM" src="https://github.com/user-attachments/assets/04f247ce-731e-42b3-895a-3a88ac3200f1" /> Weave config now includes optional Host field for dedicated cloud instances ## Checklist - [x] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:45:40 -05:00
yindo closed this issue 2026-02-21 20:45:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#29487