Skip to content

feat(provisioning): add Cassandra datasource and dashboard provisioning configs - #248

Open
HadesArchitect wants to merge 3 commits into
mainfrom
review-provisioning
Open

feat(provisioning): add Cassandra datasource and dashboard provisioning configs#248
HadesArchitect wants to merge 3 commits into
mainfrom
review-provisioning

Conversation

@HadesArchitect

@HadesArchitect HadesArchitect commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Add Grafana provisioning configuration to automatically load the Cassandra datasource and demo dashboard on startup. This enables a containerized setup where Grafana can be fully configured through configuration-as-code.

Summary by CodeRabbit

  • New Features
    • Added Grafana provisioning for an Apache Cassandra datasource.
    • Added a new demo dashboard with multiple panels showcasing queries, tables, and variable-driven filtering.
    • Added dashboard auto-loading settings so the demo appears in Grafana automatically.
  • Bug Fixes
    • Updated a dashboard variable to return cleaner location options filtered to the default bucket.

…ng configs

Add Grafana provisioning configuration to automatically load the Cassandra
datasource and demo dashboard on startup. This enables a containerized setup
where Grafana can be fully configured through configuration-as-code.
@HadesArchitect HadesArchitect self-assigned this Jun 28, 2026
@changeset-bot

changeset-bot Bot commented Jun 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b60148a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 04fadca4-52b4-480e-8c60-e9849868bc84

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds Grafana provisioning configuration files for the Cassandra datasource and demo dashboard, including a new cassandra-demo.json dashboard with multiple panel types and transformation pipelines. Also updates the loc templating variable query in the existing demo/dashboard.json to filter by bucket = 'default' and return only location.

Cassandra Demo Provisioning

Layer / File(s) Summary
Datasource and dashboard provider provisioning
provisioning/datasources/cassandra.yaml, provisioning/dashboards/dashboards.yaml
Adds a Cassandra datasource provisioning entry targeting cassandra:9042 with test keyspace and ONE consistency, and a file-based dashboard provider pointing to /etc/grafana/provisioning/dashboards.
New provisioned demo dashboard
provisioning/dashboards/cassandra-demo.json
Adds the full "Cassandra Datasource Demo" dashboard with metadata, timeseries/graph/table panels, transformation pipelines (merge, organize, sortBy), and a loc templating variable.
Fix loc variable query in existing demo dashboard
demo/dashboard.json
Narrows the loc variable query to SELECT location FROM test.sensors_locations WHERE bucket = 'default', removing the previously returned sensor_id column.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐇 Hop hop, the dashboards appear,
Provisioned with Cassandra so clear!
The loc variable now filters true,
Only bucket='default' comes through.
No more manual setup, just run and cheer! 🎉

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding Cassandra datasource and dashboard provisioning configs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch review-provisioning

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
provisioning/dashboards/dashboards.yaml (1)

8-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Turn off UI updates for the provisioned dashboard.

With allowUiUpdates: true, users can save changes that diverge from cassandra-demo.json and then get overwritten on restart. That is a poor fit for a config-as-code demo.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@provisioning/dashboards/dashboards.yaml` at line 8, The provisioned dashboard
is currently configured to allow UI edits, which can let changes drift from the
source JSON and be overwritten on restart. Update the dashboard provisioning in
dashboards.yaml by changing the allowUiUpdates setting for the provisioned
dashboard to disable UI updates, keeping the demo config-as-code aligned with
cassandra-demo.json.
provisioning/datasources/cassandra.yaml (1)

9-9: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Disable UI edits on the provisioned datasource.

editable: true lets the datasource drift from the committed provisioning file, which undermines the config-as-code startup flow described in this PR. Prefer false unless UI mutation is explicitly part of the demo.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@provisioning/datasources/cassandra.yaml` at line 9, The provisioned Cassandra
datasource is currently marked editable, which allows UI changes to drift from
the committed provisioning config. Update the datasource provisioning entry to
disable UI edits by changing the editable setting to false in the Cassandra
datasource definition, keeping the config-as-code flow consistent unless the
demo explicitly requires mutation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@provisioning/dashboards/cassandra-demo.json`:
- Around line 300-315: The Cassandra demo dashboard query is still using the old
`loc` contract by selecting `sensor_id, location` and filtering `sensor_id =
${loc}` in the targets query. Update the relevant panel definition in
`cassandra-demo.json` to match the fixed dashboard behavior used by the `loc`
variable: make the `loc` query location-only and change the `target` filter to
compare `location` against `${loc}`. Also apply the same adjustment to the
referenced duplicate panel block so both dashboard definitions stay aligned.

---

Nitpick comments:
In `@provisioning/dashboards/dashboards.yaml`:
- Line 8: The provisioned dashboard is currently configured to allow UI edits,
which can let changes drift from the source JSON and be overwritten on restart.
Update the dashboard provisioning in dashboards.yaml by changing the
allowUiUpdates setting for the provisioned dashboard to disable UI updates,
keeping the demo config-as-code aligned with cassandra-demo.json.

In `@provisioning/datasources/cassandra.yaml`:
- Line 9: The provisioned Cassandra datasource is currently marked editable,
which allows UI changes to drift from the committed provisioning config. Update
the datasource provisioning entry to disable UI edits by changing the editable
setting to false in the Cassandra datasource definition, keeping the
config-as-code flow consistent unless the demo explicitly requires mutation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a3f8bc4f-3350-4f73-9bea-490b17386822

📥 Commits

Reviewing files that changed from the base of the PR and between cc6b21f and 13ecca4.

📒 Files selected for processing (4)
  • demo/dashboard.json
  • provisioning/dashboards/cassandra-demo.json
  • provisioning/dashboards/dashboards.yaml
  • provisioning/datasources/cassandra.yaml
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: compatibilitycheck
  • GitHub Check: Build, lint and unit tests
🔇 Additional comments (1)
demo/dashboard.json (1)

675-683: LGTM!

Comment on lines +300 to +315
"targets": [
{
"alias": "{{ sensor_id }}:{{ location }}",
"columnId": " ",
"columnTime": " ",
"columnValue": " ",
"datasource": {
"type": "hadesarchitect-cassandra-datasource",
"uid": "cassandra-datasource"
},
"datasourceId": 1,
"queryType": "query",
"rawQuery": true,
"refId": "A",
"target": "SELECT sensor_id, temperature, registered_at, location FROM test.test WHERE sensor_id = ${loc} AND registered_at > $__timeFrom and registered_at < $__timeTo",
"type": "timeserie"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Align the provisioned loc variable with the fixed dashboard contract.

demo/dashboard.json now defines loc as select location ..., but this dashboard still defines it as select sensor_id, location ... and uses it in Line 314 as sensor_id = ${loc}. The provisioned demo will diverge from the fixed dashboard behavior. Mirror the same location-only query here and filter on location instead.

Suggested alignment
-          "target": "SELECT sensor_id, temperature, registered_at, location FROM test.test WHERE sensor_id = ${loc} AND registered_at > $__timeFrom and registered_at < $__timeTo",
+          "target": "SELECT sensor_id, temperature, registered_at, location FROM test.test WHERE location = '${loc}' AND registered_at > $__timeFrom and registered_at < $__timeTo",
...
-        "definition": "select sensor_id, location from test.sensors_locations where bucket = 'default'",
+        "definition": "select location from test.sensors_locations where bucket = 'default'",
...
-          "rawQuery": "select sensor_id, location from test.sensors_locations where bucket = 'default'"
+          "rawQuery": "select location from test.sensors_locations where bucket = 'default'"

Also applies to: 622-630

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@provisioning/dashboards/cassandra-demo.json` around lines 300 - 315, The
Cassandra demo dashboard query is still using the old `loc` contract by
selecting `sensor_id, location` and filtering `sensor_id = ${loc}` in the
targets query. Update the relevant panel definition in `cassandra-demo.json` to
match the fixed dashboard behavior used by the `loc` variable: make the `loc`
query location-only and change the `target` filter to compare `location` against
`${loc}`. Also apply the same adjustment to the referenced duplicate panel block
so both dashboard definitions stay aligned.

@HadesArchitect

Copy link
Copy Markdown
Owner Author

Finally
image

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