Skip to content

fix(logs): wire --storage flag through to Datadog API#135

Merged
platinummonkey merged 3 commits intodatadog-labs:mainfrom
matthew-moon-jet:fix/logs-storage-flag-silently-ignored
Mar 1, 2026
Merged

fix(logs): wire --storage flag through to Datadog API#135
platinummonkey merged 3 commits intodatadog-labs:mainfrom
matthew-moon-jet:fix/logs-storage-flag-silently-ignored

Conversation

@matthew-moon-jet
Copy link
Contributor

Summary

The --storage flag was accepted by all four log commands (search, list, query, aggregate) but silently discarded. In src/main.rs all four dispatch arms used storage: _, so the value was never forwarded to the command functions and requests always used the default index tier regardless of what the user specified.

Changes

  • Added LogsStorageTier import and parse_storage_tier() helper in src/commands/logs.rs with a clear error on unrecognised values (e.g. unknown storage tier "bad"; valid values are: indexes, online-archives, flex)
  • Wired storage: Option<String> parameter through search(), list(), query(), and aggregate() functions (native + WASM variants)
  • Applied parsed tier to LogsQueryFilter via the .storage_tier() builder method
  • Fixed dispatch in src/main.rs: changed storage: _ to storage in all four LogActions match arms
  • Fixed three existing tests and added four new unit tests covering flex storage, online-archives storage, and invalid tier error handling

Testing

  • cargo test logs — all 60 tests pass
  • Manually verified end-to-end: pup logs search --query="*" --from=15m --storage=flex --limit=5 correctly reaches the Datadog Flex tier API (previously the flag was ignored and requests hit the index tier)

🤖 Generated with Claude Sonnet 4.6

The --storage flag was accepted by the CLI but silently discarded in
all four log command dispatch arms (search, list, query, aggregate).
The value was matched as storage: _ in main.rs and never forwarded
to the command functions, so requests always used the default index
tier regardless of what the user specified.

- Added LogsStorageTier import and parse_storage_tier() helper in
  src/commands/logs.rs with error on unrecognised values
- Wired storage: Option<String> param through search(), list(),
  query(), and aggregate() functions (native + WASM variants)
- Applied parsed tier to LogsQueryFilter via .storage_tier() builder
- Fixed dispatch in src/main.rs: changed storage: _ to storage in
  all four LogActions match arms
- Fixed three existing tests and added four new unit tests covering
  flex storage, online-archives storage, and invalid tier errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@platinummonkey
Copy link
Collaborator

thanks for the PR! please run format and clippy 👍

platinummonkey and others added 2 commits February 28, 2026 18:20
Auto-format long function signatures and call sites that exceeded
the line-length limit introduced by the --storage parameter wiring.

Co-Authored-By: Matthew Moon <matthew.moon@justeattakeaway.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- logs.rs: keep storage: Option<String> param for aggregate(), drop the
  erroneous API-key-only bail (aggregate works with OAuth like search)
- test_commands.rs: keep main's test_logs_search_with_oauth success
  assertion; add None storage arg to match updated function signature

Co-Authored-By: Matthew Moon <matthew.moon@justeattakeaway.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@platinummonkey platinummonkey merged commit 6c939e0 into datadog-labs:main Mar 1, 2026
6 checks passed
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.

2 participants