Skip to content

feat(nrql): improve query UX with shortcut and time flags#59

Merged
piekstra merged 2 commits intomainfrom
piekstra/51-nrql-ux-improvements
Jan 23, 2026
Merged

feat(nrql): improve query UX with shortcut and time flags#59
piekstra merged 2 commits intomainfrom
piekstra/51-nrql-ux-improvements

Conversation

@piekstra
Copy link
Copy Markdown
Collaborator

@piekstra piekstra commented Jan 23, 2026

[#51]

Improve NRQL query UX by adding shortcuts and time range flags.

Changes

  1. Direct query shortcut: nrql "<query>" now works as a shortcut for nrql query "<query>"
  2. Time range flags: Added --since and --until flags that inject SINCE/UNTIL clauses into the query
  3. Better error messages: When no query is provided, shows helpful usage hints

Examples

# Before: only this worked
newrelic-cli nrql query "SELECT * FROM Transaction"

# Now: direct query also works
newrelic-cli nrql "SELECT * FROM Transaction"

# Time flags (appends to query)
newrelic-cli nrql "SELECT * FROM Log" --since "7 days ago"
newrelic-cli nrql "SELECT * FROM Log" --since "2025-01-01" --until "2025-01-15"

Error message improvement

$ newrelic-cli nrql
Error: query is required

Usage:
  newrelic-cli nrql "<query>"
  newrelic-cli nrql query "<query>"

Did you mean: newrelic-cli nrql query "<your-query>"?

Test Plan

  • Build passes: make build
  • Tests pass: make test
  • Direct query works: ./newrelic-cli nrql "SELECT 1"
  • Query subcommand still works: ./newrelic-cli nrql query "SELECT 1"
  • --since flag works: ./newrelic-cli nrql "SELECT count(*) FROM Transaction" --since "1 hour ago"
  • Error message is helpful: ./newrelic-cli nrql

Closes #51

- Allow direct query with `nrql "<query>"` as shortcut for `nrql query`
- Add --since and --until flags for time range filtering
- Improve error message when query is missing with helpful suggestions

[#51]
@piekstra piekstra force-pushed the piekstra/51-nrql-ux-improvements branch from a06a2fd to 5904f79 Compare January 23, 2026 16:58
@piekstra piekstra merged commit c3826d5 into main Jan 23, 2026
2 checks passed
@piekstra piekstra deleted the piekstra/51-nrql-ux-improvements branch January 23, 2026 18:30
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 NRQL query UX and error messages

2 participants