Skip to content

fix(analysis): provide actionable error for empty metric results in AnalysisRun#4679

Open
Kunalbehbud wants to merge 2 commits intoargoproj:masterfrom
Kunalbehbud:fix/evaluate-empty-metric-result
Open

fix(analysis): provide actionable error for empty metric results in AnalysisRun#4679
Kunalbehbud wants to merge 2 commits intoargoproj:masterfrom
Kunalbehbud:fix/evaluate-empty-metric-result

Conversation

@Kunalbehbud
Copy link
Copy Markdown

Summary

When an AnalysisRun metric condition indexes into result (for example result[0]) and the provider returns an empty result set, Argo Rollouts currently surfaces a low-level evaluation error.

This change returns a more actionable message explaining that the metric result is empty or unavailable and that the condition should be guarded with len(result) > 0.

It adds unit coverage for this behavior in utils/evaluate/evaluate_test.go and metricproviders/prometheus/prometheus_test.go.

Testing

  • make lint
  • PATH="/home/kunal/Desktop/contribute/Argo/argo-rollouts/dist:$PATH" ./test/kustomize/test.sh
  • go test ./...

Fixes #2101

@Kunalbehbud Kunalbehbud changed the title fix(evaluate): provide actionable error for empty metric results in AnalysisRun fix(analysis): provide actionable error for empty metric results in AnalysisRun Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

Published E2E Test Results

  4 files    4 suites   3h 39m 11s ⏱️
120 tests 106 ✅  7 💤  7 ❌
492 runs  452 ✅ 28 💤 12 ❌

For more details on these failures, see this check.

Results for commit df6b171.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

Published Unit Test Results

2 459 tests   2 459 ✅  3m 18s ⏱️
  129 suites      0 💤
    1 files        0 ❌

Results for commit df6b171.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.94%. Comparing base (4919fcd) to head (df6b171).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4679      +/-   ##
==========================================
- Coverage   84.94%   84.94%   -0.01%     
==========================================
  Files         164      164              
  Lines       18954    18971      +17     
==========================================
+ Hits        16100    16114      +14     
- Misses       2000     2002       +2     
- Partials      854      855       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 3, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the error message for AnalysisRun

1 participant