Skip to main content

MLflow Tracing SDK is an open-source, lightweight Python package that only includes the minimum set of dependencies and functionality to instrument your code/models/agents with MLflow Tracing.

Project description

MLflow Tracing: An Open-Source SDK for Observability and Monitoring GenAI Applications🔍

Latest Docs Apache 2 License Slack Twitter

MLflow Tracing (mlflow-tracing) is an open-source, lightweight Python package that only includes the minimum set of dependencies and functionality to instrument your code/models/agents with MLflow Tracing Feature. It is designed to be a perfect fit for production environments where you want:

  • ⚡️ Faster Deployment: The package size and dependencies are significantly smaller than the full MLflow package, allowing for faster deployment times in dynamic environments such as Docker containers, serverless functions, and cloud-based applications.
  • 🔧 Simplified Dependency Management: A smaller set of dependencies means less work keeping up with dependency updates, security patches, and breaking changes from upstream libraries.
  • 📦 Portability: With the less number of dependencies, MLflow Tracing can be easily deployed across different environments and platforms, without worrying about compatibility issues.
  • 🔒 Fewer Security Risks: Each dependency potentially introduces security vulnerabilities. By reducing the number of dependencies, MLflow Tracing minimizes the attack surface and reduces the risk of security breaches.

✨ Features

🌐 Choose Backend

The MLflow Trace package is designed to work with a remote hosted MLflow server as a backend. This allows you to log your traces to a central location, making it easier to manage and analyze your traces. There are several different options for hosting your MLflow server, including:

  • Databricks - Databricks offers a FREE, fully managed MLflow server as a part of their platform. This is the easiest way to get started with MLflow tracing, without having to set up any infrastructure.
  • Amazon SageMaker - MLflow on Amazon SageMaker is a fully managed service offered as part of the SageMaker platform by AWS, including tracing and other MLflow features such as model registry.
  • Nebius - Nebius, a cutting-edge cloud platform for GenAI explorers, offers a fully managed MLflow server.
  • Self-hosting - MLflow is a fully open-source project, allowing you to self-host your own MLflow server and keep your data private. This is a great option if you want to have full control over your data and infrastructure.

🚀 Getting Started

Installation

To install the MLflow Python package, run the following command:

pip install mlflow-tracing

To install from the source code, run the following command:

pip install git+https://github.com/mlflow/mlflow.git#subdirectory=libs/tracing

NOTE: It is not recommended to co-install this package with the full MLflow package together, as it may cause version mismatches issues.

Connect to the MLflow Server

To connect to your MLflow server to log your traces, set the MLFLOW_TRACKING_URI environment variable or use the mlflow.set_tracking_uri function:

import mlflow

mlflow.set_tracking_uri("databricks")
# Specify the experiment to log the traces to
mlflow.set_experiment("/Path/To/Experiment")

Start Logging Traces

import openai

client = openai.OpenAI(api_key="<your-api-key>")

# Enable auto-tracing for OpenAI
mlflow.openai.autolog()

# Call the OpenAI API as usual
response = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[{"role": "user", "content": "Hello, how are you?"}],
)

📘 Documentation

Official documentation for MLflow Tracing can be found at here.

🛑 Features Not Included

The following MLflow features are not included in this package.

  • MLflow tracking server and UI.
  • MLflow's other tracking capabilities such as Runs, Model Registry, Projects, etc.
  • Evaluate models/agents and log evaluation results.

To leverage the full feature set of MLflow, install the full package by running pip install mlflow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlflow_tracing-3.3.2.tar.gz (926.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlflow_tracing-3.3.2-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file mlflow_tracing-3.3.2.tar.gz.

File metadata

  • Download URL: mlflow_tracing-3.3.2.tar.gz
  • Upload date:
  • Size: 926.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for mlflow_tracing-3.3.2.tar.gz
Algorithm Hash digest
SHA256 003ad9c66f884e8e8bb2f5d219b5be9bcd41bb65d77a7264d8aaada853d64050
MD5 a7188a8a705bd7aa5712c804322f5ea3
BLAKE2b-256 a223bf70405a194906b4fa809be79dfa4486406385f5f578157d947fdc741ef5

See more details on using hashes here.

File details

Details for the file mlflow_tracing-3.3.2-py3-none-any.whl.

File metadata

  • Download URL: mlflow_tracing-3.3.2-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for mlflow_tracing-3.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a3175fb3b069c9f541c7a60a663f482b3fcb4ca8f3583da3fdf036a50179e05
MD5 54f27bc6146b0e0de9624ef0c15445ac
BLAKE2b-256 5e86396a17af4e994c7ffa65609739baddc17f4436aec9511478816e157a1bda

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page