Skip to content

Python: add MLflow to the observability backend examples - #8085

Open
NekoPunch (orangeCatDeveloper) wants to merge 1 commit into
microsoft:mainfrom
orangeCatDeveloper:docs-mlflow-observability-backend
Open

Python: add MLflow to the observability backend examples#8085
NekoPunch (orangeCatDeveloper) wants to merge 1 commit into
microsoft:mainfrom
orangeCatDeveloper:docs-mlflow-observability-backend

Conversation

@orangeCatDeveloper

Copy link
Copy Markdown
Contributor

Part of #7769

Motivation & Context

The observability README shows how to point Agent Framework at Langfuse and Comet Opik, but not MLflow, which is a common OTel-based backend. MLflow accepts only traces at <tracking-uri>/v1/traces, so users who copy the base OTEL_EXPORTER_OTLP_ENDPOINT pattern also get log and metric exporters retrying against endpoints MLflow does not serve. A section with the right shape saves that detour.

Description & Review Guide

Adds an MLflow entry next to the Langfuse and Opik ones in python/samples/02-agents/observability/README.md. It passes a single OTLPSpanExporter (HTTP) with the x-mlflow-experiment-id header via configure_otel_providers(exporters=[...]), which is the same shape as pattern 2 in that README and as MLflow's own integration page, only using the current configure_otel_providers / enable_sensitive_telemetry names instead of the older setup_observability the MLflow docs still show.

Only the GitHub README half of the issue is covered here; the learn-site update is left to the maintainers since that repository is mid-migration.

Verified against a local MLflow 3.16.0 server with the snippet verbatim, driving a real Agent with an echo chat client:

$ mlflow server --backend-store-uri sqlite:///mlflow.db --port 5002
$ python mlflow_smoke.py
agent said: echo: hello mlflow

$ python -c "import mlflow; ...; mlflow.search_traces(locations=['1'], return_type='list')"
traces: 1
trace_id: tr-52d0e0ab987f500668837c5a86c2d4a6 | state: OK | spans: ['invoke_agent smoke-agent']

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The example matches the framework API and MLflow’s documented tracing configuration.

Pull request overview

Adds MLflow as a documented OpenTelemetry tracing backend for Python Agent Framework samples.

Changes:

  • Documents MLflow’s OTLP/HTTP trace endpoint and experiment header.
  • Demonstrates configuring a trace-only exporter and optional sensitive telemetry.
File summaries
File Description
python/samples/02-agents/observability/README.md Adds the MLflow setup example.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants