querying-mlflow-metrics
Original:🇺🇸 English
Translated
1 scriptsChecked / no sensitive code detected
Fetches aggregated trace metrics (token usage, latency, trace counts, quality evaluations) from MLflow tracking servers. Triggers on requests to show metrics, analyze token usage, view LLM costs, check usage trends, or query trace statistics.
11installs
Sourcemlflow/skills
Added on
NPX Install
npx skill4agent add mlflow/skills querying-mlflow-metricsTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →MLflow Metrics
Run to query metrics from an MLflow tracking server.
scripts/fetch_metrics.pyExamples
Token usage summary:
bash
python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m total_tokens -a SUM,AVGOutput:
AVG: 223.91 SUM: 7613Hourly token trend (last 24h):
bash
python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m total_tokens -a SUM \
-t 3600 --start-time="-24h" --end-time=nowOutput: Time-bucketed token sums per hour
Latency percentiles by trace:
bash
python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m latency -a AVG,P95 -d trace_nameError rate by status:
bash
python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -m trace_count -a COUNT -d trace_statusQuality scores by evaluator (assessments):
bash
python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -v ASSESSMENTS \
-m assessment_value -a AVG,P50 -d assessment_nameOutput: Average and median scores for each evaluator (e.g., correctness, relevance)
Assessment count by name:
bash
python scripts/fetch_metrics.py -s http://localhost:5000 -x 1 -v ASSESSMENTS \
-m assessment_count -a COUNT -d assessment_nameJSON output: Add to any command.
-o jsonArguments
| Arg | Required | Description |
|---|---|---|
| Yes | MLflow server URL |
| Yes | Experiment IDs (comma-separated) |
| Yes | |
| Yes | |
| No | Group by: |
| No | Bucket size in seconds (3600=hourly, 86400=daily) |
| No | |
| No | Same formats as start-time |
| No | |
For SPANS metrics (, ), add .
For ASSESSMENTS metrics, add .
span_countlatency-v SPANS-v ASSESSMENTSSee references/api_reference.md for filter syntax and full API details.