Skip to content

Commit

Permalink
Improve grafana-datasource sample (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrebnov authored Sep 9, 2024
1 parent 4bd466e commit 3470cee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions grafana-datasource/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,47 @@ This will start the Spice runtime and Grafana server. The Spice runtime will loa
## Setup with FlightSQL Grafana plugin

1. Open Grafana in your browser at [http://localhost:3000](http://localhost:3000).
2. Log in with the default credentials `admin`/`admin`, skip the password change prompt.

1. Log in with the default credentials `admin`/`admin`, skip the password change prompt.
![screenshot](./img/grafana-datasource-1.png)

3. Navigate to Administation -> Plugins and data -> Plugins.
4. Select "State: All", and search for "FlightSQL".

1. Navigate to Administation -> Plugins and data -> Plugins.
1. Select "State: All", and search for "FlightSQL".
![screenshot](./img/grafana-datasource-2.png)

5. Click on the "Install" button to install the plugin, and then "Add new data source".

1. Click on the "Install" button to install the plugin, and then "Add new data source".
![screenshot](./img/grafana-datasource-3.png)

6. Fill in the following fields:
1. Fill in the following fields:
- Name: `Spice`
- Host:Port: `spice:50051`
- Auth Type: `None`

![screenshot](./img/grafana-datasource-4.png)

7. Click on "Save & Test" to save the data source, then click on "Build a dashboard".
8. Click on "Add visualization" and select "Spice" from the list of data sources.

1. Click on "Save & Test" to save the data source, then click on "Build a dashboard".
1. Click on "Add visualization" and select "Spice" from the list of data sources.
![screenshot](./img/grafana-datasource-5.png)

9. Switch to SQL query editor and paste the following query:
1. Switch to SQL query editor and paste the following query. Then select `Zoom to data`

```sql
SELECT to_timestamp(tpep_dropoff_datetime), fare_amount FROM public.taxi_trips LIMIT 100
```

![screenshot](./img/grafana-datasource-10.png)
![screenshot](./img/grafana-datasource-6.png)

### Setup with Infinity Grafana plugin

Follow steps 1-3 from the previous section.

4. Select "State: All", and search for "Infinity". Install and click on "Add new data source".

1. Select "State: All", and search for "Infinity". Install and click on "Add new data source".
![screenshot](./img/grafana-datasource-7.png)

5. Leave the default values and click on "Save & Test".

1. Leave the default values and click on "Save & Test".
![screenshot](./img/grafana-datasource-8.png)

6. Click on "Build a dashboard" and add a new visualization. Select "Infinity" from the list of data sources.

7. Change "Method" to "POST" and "URL" to `http://spice:5000/v1/sql`. Add SQL query in body, using "Raw" mode:
1. Click on "Build a dashboard" and add a new visualization. Select "Infinity" from the list of data sources.
1. Change "Method" to "POST" and "URL" to `http://spice:8090/v1/sql`. Add SQL query in body, using "Raw" mode:

```sql
SELECT to_timestamp(tpep_dropoff_datetime), fare_amount FROM public.taxi_trips LIMIT 100
Expand Down
Binary file added grafana-datasource/img/grafana-datasource-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified grafana-datasource/img/grafana-datasource-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3470cee

Please sign in to comment.