[History Server] Add --mode=snapshot to collector for one-shot Dashboard API capture #5157
Marker written on total scrape failure
High Severity
<!-- DESCRIPTION START -->Run always writes the cluster-metadata marker before checking fetchErrors, including when every endpoint scrape failed. discoverSessionName also treats dashboard fetch failures as success and invents a session name. Together this registers an empty phantom session in object storage that the history server will list with no usable fetched_endpoints data.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: 8c57c4a2-9974-43bd-987b-4b281653a5db -->
<!-- LOCATIONS START
historyserver/pkg/collector/snapshot/snapshot.go#L96-L104
historyserver/pkg/collector/snapshot/snapshot.go#L110-L115
LOCATIONS END -->
<details>
<summary>Additional Locations (1)</summary>
historyserver/pkg/collector/snapshot/snapshot.go#L110-L115</details>
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjE5YzZlMDNmLTQzNmItNDIyMC1hYTVkLWE1YTRmMDFjMWI5ZiIsImVuY3J5cHRpb25LZXkiOiJNb1kxeFhnSnNTWDdfdDE4dGdPcDB0d19HT09Mdm1XTXFwNHRUZWdId0d3IiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjE5YzZlMDNmLTQzNmItNDIyMC1hYTVkLWE1YTRmMDFjMWI5ZiIsImVuY3J5cHRpb25LZXkiOiJNb1kxeFhnSnNTWDdfdDE4dGdPcDB0d19HT09Mdm1XTXFwNHRUZWdId0d3IiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJOdW1iZXIiOjUxNTcsImNvbW1pdFNoYSI6ImFkMGU1NmRhZjI3YzhkNjJkMGEzN2Y1ZDg0ZTZiNGY5N2RhZWJmMGUiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by Cursor Bugbot for commit ad0e56daf27c8d62d0a37f5d84e6b4f97daebf0e. Configure here.</sup>
Cancel ignored after endpoint loop
Medium Severity
<!-- DESCRIPTION START -->
After the main endpoint loop, fetchDataDatasets errors—including ctx.Err() from SIGINT/SIGTERM—are only logged, and there is no cancellation check before writing the cluster-metadata marker. A shutdown signal late in the run can still write the marker and return success.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: e715782a-457e-430a-93b9-d7443a44a141 -->
<!-- LOCATIONS START
historyserver/pkg/collector/snapshot/snapshot.go#L86-L108
LOCATIONS END -->
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmQzODUxYmE2LTcwMjEtNDk0ZC05YWQ5LWQyZWZmZTM5ODA5NCIsImVuY3J5cHRpb25LZXkiOiJxeE43LXJvQlZkZy1tdmRLRUdjR19scEFRc3pxaENxVld1UHZHaVRQVlZJIiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmQzODUxYmE2LTcwMjEtNDk0ZC05YWQ5LWQyZWZmZTM5ODA5NCIsImVuY3J5cHRpb25LZXkiOiJxeE43LXJvQlZkZy1tdmRLRUdjR19scEFRc3pxaENxVld1UHZHaVRQVlZJIiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJOdW1iZXIiOjUxNTcsImNvbW1pdFNoYSI6ImFkMGU1NmRhZjI3YzhkNjJkMGEzN2Y1ZDg0ZTZiNGY5N2RhZWJmMGUiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by Cursor Bugbot for commit ad0e56daf27c8d62d0a37f5d84e6b4f97daebf0e. Configure here.</sup>
cc @chiayi
Why are we removing which storage backend we failed to create the writer for?
Why not use the jobsEndpoint declared in the const here?
So curious on why some of the endpoints like /api/v0/tasks or logical/actors aren't being collected?
I don't think we should be generating a session ID. Also, wouldn't failures from calling /api/v0/cluster_metadata invent an session ID every time instead of failing, instead of letting users know that dashboard was unreachable?
Should the snapshot run even if the user sets --enable-event-collector and --enable-log-collector to disabled?
PTAL
Empty skips inflate stored count
Medium Severity
<!-- DESCRIPTION START -->fetchAndStore returns success when the response body is empty without writing anything, and Run still increments storedCount. The new total-failure guard then treats that as a real store, so a cluster-metadata marker can be written (and the snapshot reported successful) even when no fetched_endpoints objects exist—for example when most endpoints error and at least one returns an empty body.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: 3e5dac70-4a3c-407a-a7ed-e0fab10ab96d -->
<!-- LOCATIONS START
historyserver/pkg/collector/snapshot/snapshot.go#L84-L103
historyserver/pkg/collector/snapshot/snapshot.go#L160-L163
LOCATIONS END -->
<details>
<summary>Additional Locations (1)</summary>
historyserver/pkg/collector/snapshot/snapshot.go#L160-L163</details>
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjYzMTNhOGMwLWYyNTktNGY0Ny1hYzZiLWE5ZDRkOGYzZjdmNiIsImVuY3J5cHRpb25LZXkiOiJNRDJ2Tkhnczg5dm9WdEE5U0RoUlV1OUs2S19KdmRlOE1HNzUzTTJ1ODQ4IiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjYzMTNhOGMwLWYyNTktNGY0Ny1hYzZiLWE5ZDRkOGYzZjdmNiIsImVuY3J5cHRpb25LZXkiOiJNRDJ2Tkhnczg5dm9WdEE5U0RoUlV1OUs2S19KdmRlOE1HNzUzTTJ1ODQ4IiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJOdW1iZXIiOjUxNTcsImNvbW1pdFNoYSI6IjE4NTY5ZTgwNjQwMGMwOWFjODk0ZmQzYjkyNTdkZjY5MTgyNjkzZTgiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by Cursor Bugbot for commit 18569e806400c09ac894fd3b9257df69182693e8. Configure here.</sup>
<!-- BUGBOT_REVIEW -->
<!-- BUGBOT_REVIEW_STALE -->
Stale Bugbot comment from a previous run.
Session name discovery uses missing fields
High Severity
<!-- DESCRIPTION START -->discoverSessionName reads data.session_name and data.session_dir from /api/v0/cluster_metadata, but the live Dashboard response does not include those fields. Snapshot mode therefore fails before writing any fetched_endpoints or the cluster-metadata marker when pointed at a real cluster.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: 6ba76507-5e07-4f1e-b1ec-1a67be3eb549 -->
<!-- LOCATIONS START
historyserver/pkg/collector/snapshot/snapshot.go#L128-L154
LOCATIONS END -->
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjhjNjUxOTIxLTA2YjYtNGJmMC05MGYyLThkYWE2Njk5NjRlMyIsImVuY3J5cHRpb25LZXkiOiJyc0hTMk1OdkNMRGtHOHpvVGEyUDl6VEdndGx1YW1UTVV0eUlXbDg3UFpjIiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjhjNjUxOTIxLTA2YjYtNGJmMC05MGYyLThkYWE2Njk5NjRlMyIsImVuY3J5cHRpb25LZXkiOiJyc0hTMk1OdkNMRGtHOHpvVGEyUDl6VEdndGx1YW1UTVV0eUlXbDg3UFpjIiwiYnJhbmNoIjoiZmVhdC9oaXN0b3J5LXNlcnZlci1zbmFwc2hvdCIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJOdW1iZXIiOjUxNTcsImNvbW1pdFNoYSI6IjRkMDllODMzNmI1M2MxMmJhYThlZmFlYjA5OTFlOGUwOTI1ZmFjMTMiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by Cursor Bugbot for commit 4d09e8336b53c12baa8efaeb0991e8e0925fac13. Configure here.</sup>
<!-- BUGBOT_REVIEW -->
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
<!-- BUGBOT_FIX_ALL -->
<a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aToyNjAwNWYyYy05ODQwLTQ1ZTQtOTZlYS1iNzM2NmMxNWRlNTQiLCJlbmNyeXB0aW9uS2V5IjoiTGRsa2x5STFKblB1eGdNUUZQaW9SUjJNV1hVZndtc25rZHBWYWFCdWZVYyIsImJyYW5jaCI6ImZlYXQvaGlzdG9yeS1zZXJ2ZXItc25hcHNob3QiLCJyZXBvT3duZXIiOiJyYXktcHJvamVjdCIsInJlcG9OYW1lIjoia3ViZXJheSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
<!-- /BUGBOT_FIX_ALL -->
<sup>Reviewed by Cursor Bugbot for commit 4d09e8336b53c12baa8efaeb0991e8e0925fac13. Configure here.</sup>
chiayi
szaher
Introduces a new execution mode for the collector binary that connects to a remote Ray Dashboard, scrapes all available endpoint state in a single pass, writes the responses to object storage as fetched_endpoints, creates a cluster-metadata session marker, and exits.
<!-- Thank you for your contribution! -->
<!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. -->
Why are these changes needed?
<!-- Please give a short summary of the change and the problem this solves. -->
Related issue number
Issue: #4998
<!-- For example: "Closes #1234" -->
Labels
<!-- Please add the appropriate labels to this PR. -->
doc-updates-requiredlabel.breaking-changelabel.Checks
- [ ] Unit tests
- [ ] Manual tests
- [ ] This PR is not tested :(
<!-- If you selected "Manual tests" above, please fill in the section below. Otherwise you can remove it. -->
Manual test instructions
<!--
Provide step-by-step instructions so reviewers can verify your changes.
Include any relevant screenshots or logs demonstrating the behavior.
-->