mcpField
Q
querying-mlflow-metrics

querying-mlflow-metrics

github.com/mlflowData & databases82959 installsUpdated 2d ago
Repository

About querying-mlflow-metrics

A command-line skill for querying metrics from an MLflow tracking server. It supports aggregation, grouping, time buckets, and table or JSON output.

Key features

  1. 01Query trace, span, and assessment metrics
  2. 02Aggregate with statistical functions
  3. 03Group results by dimensions
  4. 04Bucket metrics over time
  5. 05Output tables or JSON

Use cases

  1. 01Summarize token usage across experiments
  2. 02Inspect hourly metric trends
  3. 03Compare latency by trace name
  4. 04Review assessment scores by evaluator

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mlflow/skills --skill querying-mlflow-metrics

After installing, type/querying-mlflow-metricsin Claude Code to confirm it loaded.

Bundled filesreferences/api_reference.mdscripts/fetch_metrics.py

Details

From the project README

MLflow Metrics

Run scripts/fetch_metrics.py to query metrics from an MLflow tracking server.

Examples

Token usage summary:

python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m total_tokens -a SUM,AVG

Output: AVG: 223.91 SUM: 7613

Hourly token trend (last 24h):

python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m total_tokens -a SUM \
    -t 3600 --start-time="-24h" --end-time=now

Output: Time-bucketed token sums per hour

Latency percentiles by trace:

python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m latency -a AVG,P95 -d trace_name

Error rate by status:

python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m trace_count -a COUNT -d trace_status

Quality scores by evaluator (assessments):

python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -v ASSESSMENTS \
    -m assessment_value -a AVG,P50 -d assessment_name

Output: Average and median scores for each evaluator (e.g., correctness, relevance)

Assessment count by name:

python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -v ASSESSMENTS \
    -m assessment_count -a COUNT -d assessment_name

JSON output: Add -o json to any command.

Arguments

ArgRequiredDescription
-s, --serverYesMLflow server URL
-x, --experiment-idsYesExperiment IDs (comma-separated)
-m, --metricYestrace_count, latency, input_tokens, output_tokens, total_tokens
-a, --aggregationsYesCOUNT, SUM, AVG, MIN, MAX, P50, P95, P99
-d, --dimensionsNoGroup by: trace_name, trace_status
-t, --time-intervalNoBucket size in seconds (3600=hourly, 86400=daily)
--start-timeNo-24h, -7d, now, ISO 8601, or epoch ms
--end-timeNoSame formats as start-time
-o, --outputNotable (default) or json

For SPANS metrics (span_count, latency), add -v SPANS. For ASSESSMENTS metrics, add -v ASSESSMENTS.

See references/api_reference.md for filter syntax and full API details.

Comments

Markdown supported