feat(id-file): support dashboards in import and sync state loading - #686
Merged
michael-richey merged 2 commits intoSep 1, 2026
Merged
Conversation
michael-richey
marked this pull request as ready for review
September 1, 2026 19:10
michael-richey
force-pushed
the
michael.richey/add-dashboards-id-file-support
branch
from
September 1, 2026 19:11
919c8ba to
01cb5df
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Enables dashboard-specific imports through --id-file.
Changes:
- Adds dashboards to the import allowlist.
- Adds dashboard ID-fetch and error-handling tests.
- Updates unsupported-type tests to use notebooks.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
datadog_sync/utils/configuration.py |
Adds dashboard ID-file support. |
tests/unit/test_dashboards_id_file.py |
Tests dashboard ID imports. |
tests/unit/test_get_resources_by_ids_experiment.py |
Updates unsupported-type coverage. |
tests/unit/test_id_file_state_load_scoping.py |
Updates parser rejection coverage. |
tests/unit/test_id_file_subprocess_experiment.py |
Updates subprocess rejection coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Add 'dashboards' to _ID_FILE_IMPORT_SUPPORTED_TYPES so the import command
accepts --id-file payloads selecting specific dashboards by ID. This lets
callers split a large dashboards set into multiple sync-cli subprocesses
(importing a subset of IDs per invocation) instead of one monolithic run
that can time out before finishing on orgs with tens of thousands of
dashboards.
Dashboards.import_resource(_id=...) already performs a real GET to
/api/v1/dashboard/{id} for the full body (widgets are omitted by the LIST
endpoint) and short-circuits when the caller passes a body already carrying
widgets, so the id-file path's get_resources_by_ids -> import_resource(_id)
-> queue-handler _import_resource(resource=body) sequence does exactly one
GET per dashboard with no double-fetch. Verified via
tests/unit/test_dashboards_id_file.py.
Three existing tests used 'dashboards' as their example of an *unsupported*
type in --id-file; updated them to 'notebooks' (genuinely unsupported) to
preserve their intent.
michael-richey
force-pushed
the
michael.richey/add-dashboards-id-file-support
branch
from
September 1, 2026 19:15
01cb5df to
5d78122
Compare
riyazsh
approved these changes
Sep 1, 2026
michael-richey
deleted the
michael.richey/add-dashboards-id-file-support
branch
September 1, 2026 20:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
dashboardsto the import and state-load--id-fileallowlists:import --id-filecan fetch only the selected dashboard IDs.sync --minimize-reads --id-filecan load state only for those dashboard IDs because dashboard state keys are ID-derivable.Why
Lets callers split a large dashboard set into multiple sync-cli subprocesses instead of one monolithic import that can time out before finishing. The same ID payload can scope state reads during sync, avoiding a full type load when only those dashboards are being processed.
Verification
Dashboards.import_resource(_id=...)performs a realGET /api/v1/dashboard/{id}for the full body because widgets are omitted by the LIST endpoint. It short-circuits when the caller supplies a body that already contains widgets, so theget_resources_by_ids -> import_resource(_id) -> queue-handler _import_resource(resource=body)path performs exactly one GET per dashboard.Dashboard state is stored as
dashboards.<id>.json, soState.get_by_idscan construct the source and destination keys directly forsync --minimize-reads.tests/unit/test_dashboards_id_file.pypins both allowlist entries, the per-ID GET, the prefetched-body short-circuit, 403→SkipResource, and 5xx propagation.dashboardsas their unsupported-type example now usenotebooksto preserve their intent.