Skip to content

feat(monitor config): add --history-start-date flag#12

Open
adkinsty wants to merge 1 commit intomainfrom
feat/monitor-config-history-start-date
Open

feat(monitor config): add --history-start-date flag#12
adkinsty wants to merge 1 commit intomainfrom
feat/monitor-config-history-start-date

Conversation

@adkinsty
Copy link
Copy Markdown
Collaborator

@adkinsty adkinsty commented May 3, 2026

Summary

Surfaces the metricMonitoring.historicalMetricCollectionScanStartDate field via the CLI. Accepts three input forms:

--history-start-date 120d                     # relative (also Nm = months, Ny = years)
--history-start-date 2026-01-03               # calendar date, midnight UTC
--history-start-date 2026-01-03T00:00:00Z     # RFC3339

Validation: must be in the past; warns when more than 2 years ago since Soda may not retain data that far back.

Refactors monitor config update to fetch the current config first and merge user overrides into it before POSTing. POST /api/v1/datasets/{id} with metricMonitoring.enabled=true rejects payloads that omit scanSchedule and datasetMetricMonitorsConfiguration, so we always send them back from current state. Same merge pattern applies to --schedule and --timezone — the existing handler discarded them on every write.

Adds an explicit guard: --enable on a dataset with no existing schedule or monitor configuration now errors with a pointer to sodacli dataset onboard --monitoring, instead of failing opaquely server-side.

Stdlib only (time, regexp, strconv).

Test plan

  • sodacli monitor config <id> --history-start-date 120d writes RFC3339 ~120 days ago
  • sodacli monitor config <id> --history-start-date 2026-03-15 writes midnight UTC of that date
  • sodacli monitor config <id> --history-start-date 3y writes RFC3339 ~3 years ago AND emits a >2y warning
  • sodacli monitor config <id> (read-only) shows the new "Historical from" value
  • Schedule + monitors total preserved across updates (merge working)
  • --history-start-date "tomorrow" errors with format hint
  • --history-start-date 2030-01-01 errors with "must be in the past"
  • Build clean on this branch

Surfaces the metricMonitoring.historicalMetricCollectionScanStartDate
field via the CLI. Accepts three input forms:

  --history-start-date 120d         (relative: also Nm = months, Ny = years)
  --history-start-date 2026-01-03   (calendar date, midnight UTC)
  --history-start-date 2026-01-03T00:00:00Z   (RFC3339)

Validation: must be in the past; warns when > 2 years ago since Soda
may not retain data that far back.

Refactors monitor config update to fetch the current config first and
merge user overrides into it before POSTing. POST /api/v1/datasets/{id}
with metricMonitoring.enabled=true rejects payloads that omit
scanSchedule and datasetMetricMonitorsConfiguration, so we always send
them back from the current state. Same merge applies to --schedule and
--timezone — the existing handler discarded them on every write.

Adds an explicit guard: --enable on a dataset with no existing schedule
or monitor configuration now errors with a pointer to
`sodacli dataset onboard --monitoring`, instead of failing opaquely
server-side.

Stdlib only (time, regexp, strconv).
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.

1 participant