Skip to content

fix: dbrp correct json output#575

Merged
devanbenz merged 3 commits intomainfrom
db/24485/dbrp-json
Mar 25, 2026
Merged

fix: dbrp correct json output#575
devanbenz merged 3 commits intomainfrom
db/24485/dbrp-json

Conversation

@devanbenz
Copy link
Copy Markdown
Contributor

@devanbenz devanbenz commented Mar 25, 2026

Fixes json output for dbrp, previously we had a plaintext header, this just outputs json:

example w/ jq usage (this would fail previously)

> ./bin/darwin/arm64/influx v1 dbrp list --json | jq '.[] | {database, bucketID}'

{
  "database": "_monitoring",
  "bucketID": "45401d2924820280"
}
{
  "database": "_tasks",
  "bucketID": "26718fb6c27103ad"
}
{
  "database": "bucket1",
  "bucketID": "b2d96a0fe6613f35"
}
{
  "database": "bucket1",
  "bucketID": "55d7cf89e217cf37"
}
{
  "database": "test",
  "bucketID": "720a8dfe9a01323f"
}

closes: influxdata/influxdb#24485

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes --json output for the v1 DBRP list command so it emits valid JSON (single JSON array) instead of interleaving JSON with human-readable section headers (per influxdb issue #24485).

Changes:

  • Update Client.List to return early with a single PrintJSON(...) when PrintAsJSON is enabled.
  • Add a regression test that asserts List JSON output is valid JSON and contains the expected DBRPs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
clients/v1_dbrps/v1_dbrps.go Ensures JSON mode prints a single JSON array and avoids printing the virtual/physical section headers.
clients/v1_dbrps/v1_dbrps_test.go Adds a JSON-focused test validating the list output is parseable JSON with expected entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@devanbenz devanbenz requested a review from Copilot March 25, 2026 21:43
@devanbenz devanbenz changed the title feat: Fix dbrp json output fix: dbrp correct json output Mar 25, 2026
@devanbenz devanbenz self-assigned this Mar 25, 2026
@devanbenz devanbenz added the bug Something isn't working label Mar 25, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@devanbenz devanbenz force-pushed the db/24485/dbrp-json branch from ae053bb to ec59aa8 Compare March 25, 2026 21:54
@devanbenz devanbenz merged commit 4d6fac2 into main Mar 25, 2026
20 checks passed
@devanbenz devanbenz deleted the db/24485/dbrp-json branch March 25, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DBRP CLI does not output valid JSON

3 participants