MLflow recently introduced built-in tracking of token usage and cost for LLM spans. This proposal extends that capability to support cost attribution for arbitrary span types, allowing for better resource management and visualization in the UI.
<!-- issue-warning --> > [!WARNING] > Before submitting a PR, please make sure that: > - A maintainer has triaged this issue and applied the `ready` label > - This issue has no assignee > - No duplicate PR exists > > PRs not meeting these requirements may be automatically closed. ### Willingness to contribute Yes. I can contribute this feature independently. ### Proposal Summary MLflow recently introduced built-in tracking of token usage and cost for LLM spans. This proposal extends that capability so any span type can declare a standardized cost attribute, and MLflow automatically visualizes these costs similarly to the existing UI for inference span costs. Specifically, the feature would: - Allow any span to define a standardized cost attribute (e.g., `mlflow.span.cost`) - Include these costs in trace-level total cost aggregation - Display span cost in the UI - Include non-LLM span costs in experiment-level cost charts This would allow MLflow to track costs not only for LLM inf