[mason] tracing: UC-only and opt-in via mason tracing setup - #545
Open
jamesbxwu wants to merge 8 commits into
Open
[mason] tracing: UC-only and opt-in via mason tracing setup#545jamesbxwu wants to merge 8 commits into
mason tracing setup#545jamesbxwu wants to merge 8 commits into
Conversation
Rework `mason tracing` into one experiment-centric model with two backends, so local iteration has zero setup friction while production traces are governed. - `mason dev`: tracing on by default to a managed "[dev] <app>" experiment under the user's workspace home (no Unity Catalog access needed). The runtime auto-creates it on first trace, so dev makes no MLflow call. - `mason tracing setup --trace-location <catalog.schema> [--warehouse-id]`: records the UC schema (+ optional warehouse) in agent.toml. - `mason deploy`: gated on UC tracing. When configured it creates a UC-linked experiment and wires MLFLOW_TRACKING_URI/EXPERIMENT_NAME into app.yaml; otherwise it stops and points at `mason tracing setup`. A UC experiment can only be linked while empty, so an experiment that already holds non-UC traces raises a clear error pointing at the trace-to-UC migration docs. - `mason tracing list`: resolves --trace-location -> agent.toml -> the [dev] experiment, and queries by `locations=` (drops the deprecated experiment_ids path that also crashed on current MLflow). `get` stays id-only (self-locating). - render: wrap field/cell values in Text so Rich doesn't parse "[dev]" as markup and silently drop it. Removes the `--with-traces` / `--traces-experiment` flags on dev/deploy in favor of the agent.toml binding. Unit tests updated; the deploy-time UC provisioning is covered with mocked mlflow (verified live separately). Co-authored-by: Isaac <no-reply@databricks.com>
Listing the managed [dev] experiment from inside a project that has a UC warehouse configured was needlessly pulling that warehouse in and cold-starting it. A managed experiment is read from the tracking store and needs no warehouse; only a UC catalog.schema does. Gate the warehouse on the location being a UC schema. Co-authored-by: Isaac <no-reply@databricks.com>
Replace the split dev(non-UC)/deploy(UC) tracing model with one Unity Catalog path shared by `mason dev` and `mason deploy`. - Tracing is off until `mason tracing setup --trace-location <catalog.schema>` records a UC schema in agent.toml. Both dev and deploy then create/link a per-app UC experiment and wire the same MLFLOW_TRACKING_URI + MLFLOW_EXPERIMENT_NAME + MLFLOW_TRACING_DESTINATION (+ warehouse). - Deploy no longer gates on tracing: an unconfigured project deploys with a one-line hint instead of being blocked, so developers without catalog/schema access are never stuck. - `mason dev` checks the trace config (a cheap agent.toml read) before touching the workspace, so a plain unconfigured or offline dev run makes no auth call. - Add opentelemetry-exporter-otlp-proto-http to the runtime/runtime-openai extras: UC trace export uses HTTP OTLP. - Revert the runtime configure_tracing gate change; we always wire both the experiment and the destination, which the published runtime already accepts. - Drop the managed [dev] experiment machinery (dev_experiment_name, MasonClient.ensure_experiment) and the `[dev]` fallback in `tracing list`. Verified end to end for LangGraph and OpenAI: dev with no tracing logs nothing; after setup, dev and a real deploy both land traces in the configured UC schema.
mason tracing setup
provision_trace_experiment now returns Optional[tuple]; narrow it with an `assert result is not None` before unpacking so `ty check` passes.
After tracing is configured, `mason dev` and `mason deploy` now show the MLflow experiment id and a direct link to its traces page (`<host>/ml/experiments/<id>/traces`, built from the profile's workspace host) instead of just the experiment name. - ensure_uc_experiment now returns the experiment id. - provision_trace_experiment returns (experiment_id, catalog_schema). - add experiment_ui_url(host, experiment_id) and render it in both panels.
# Conflicts: # integrations/mason/src/databricks_mason/tracing.py
… + messaging - get/list now require a resolvable SQL warehouse (--warehouse-id, the project's configured warehouse, or MLFLOW_TRACING_SQL_WAREHOUSE_ID) and fail fast with a clear hint. get previously ignored the configured warehouse entirely. - provision_trace_experiment now creates the parent /Users/<user>/mason-traces workspace folder before create_experiment, so first-time dev/deploy on a workspace that lacks it no longer fails (create_experiment does not create intermediate folders). - Refresh tracing help/messages: accurate warehouse help, verb-first success title, imperative next-steps, and corrected/removed stale help.py examples. Co-authored-by: Isaac <no-reply@databricks.com>
Reconcile main's #540 agent.toml store-binding model with the UC-only tracing redesign so both stores and tracing are configured via agent.toml (no flags): - Stores: adopt main's model - `mason memory/sessions bind` records bindings in agent.toml; dev/deploy read them via store_bindings and validate they exist (validate_stores). Dropped --memory/--session/--no-create-stores flags and the store-env-into-app.yaml path (stores are read from agent.toml at runtime). - Tracing: keep UC-only via `mason tracing setup` + provision_trace_experiment. Dropped main's --with-traces/--traces-experiment flags and the trace-env branch of the old validator; removed the stale `mason tracing instrument` help example. - agent_project.py: keep both additions - main's memory_store_id and our trace_location/trace_warehouse. - Kept main's #515 --instances deploy feature and #538 UI changes as-is. Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UX Change
mason tracing setup --trace-location <catalog.schema>records a UC schema inagent.toml. Tracing is disabled until then.mason deployandmason devdisplays a message to remind users to set up tracing usingmason tracing setupKey changes
dev.py/deploy.py: shareprovision_trace_experiment(returnsNonewhen unconfigured; no gate).pyproject.toml: addopentelemetry-exporter-otlp-proto-httpto theruntime/runtime-openaiextras - UC trace export uses HTTP OTLP.runtime/tracing.py: reverted to the shipped gate (has_destination and has_experiment); we always wire both, so no runtime change is required.[dev]experiment machinery (dev_experiment_name,MasonClient.ensure_experiment, the[dev]fallback intracing list).Manual testing
Full CUJ against a real workspace, from a fresh venv with the CLI installed from this branch, for both LangGraph and OpenAI. Sequencing: no tracing first (confirm nothing is logged), then
mason tracing setup, then confirm traces land - in bothmason devand a realmason deploy.mason initmason dev, no tracingMLFLOW_*envMLFLOW_*envmason tracing setup --trace-location james_wu.masonagent.tomlagent.tomlmason dev, tracing onjames_wu.masonjames_wu.masonmason deploy, tracing onjames_wu.masonWarning message when tracing is off
mason devwith nomason tracing setuprun - noMLFLOW_*env is wired, nothing is exported, and the startup panel nudges (never blocks):mason deployon an unconfigured project shows the same one-line hint as a next step instead of gating, so the deploy still succeeds.After
mason tracing setup(tracing on)mason devnow names the destination in its panel:mason deploywires it and creates the UC-linked experiment:Traces actually land
mason tracing listafter dev invokes (both frameworks) and a live invoke of the deployed OpenAI app - all three in the configured UC schema:Notes
mason tracing list) uses the workspace default SQL warehouse; pass--warehouse-id(ormason tracing setup --warehouse-id) where no default warehouse resolves in the target workspace.