Skip to content

Commit de73969

Browse files
authored
Merge pull request #166 from hennevogel/feature/adapt-dashboards
Adapt sample dashboards to recent changes
2 parents e8de56a + e2b3aa9 commit de73969

19 files changed

+8745
-3884
lines changed

sample-dashboard/README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,42 @@ A dashboard providing Ruby on Rails performance insights based on
44
[Free Software](https://www.fsf.org/about/what-is-free-software), ready to
55
run inside your data-center.
66

7-
![Screenshot of the dashboard](https://grafana.com/api/dashboards/10428/images/6557/image)
7+
![Screenshot of the dashboard](https://grafana.com/api/dashboards/10428/images/10103/image)
88

9-
By default it measures (in various forms):
9+
By default it measures (in various forms) performance of:
1010

11-
- Controller Action Runtime
12-
- View/Partial Render Runtime
13-
- Database Query Runtime
11+
- Controller Actions
12+
- View/Partial Rendering
13+
- Database Queries
14+
- ActiveJobs
15+
- ActionMailers
1416

15-
It provides an overview and you can also drill down into numbers on a per request basis. Of course you can use all the awesome features that Influx (Downsampling/Data Retention), Grafana (Alerts, Annotations) and influxdb-rails (custom tags) provide and extend this to your needs. Use your freedom and run, copy, distribute, study, change and improve this software!
17+
The dashboards provide an overview and various ways to drill down into numbers on a per request or per action basis. Of course you can use all the awesome features that Influx (Downsampling/Data Retention), Grafana (Alerts, Annotations) and influxdb-rails (custom tags) provide and extend this to your needs. Use your freedom and run, copy, distribute, study, change and improve this software!
1618

1719
## Requirements
1820

19-
To be able to measure performance you need the following things available:
21+
To be able to measure performance of your Ruby on Rails application you need to have the following things available:
2022

21-
- [InfluxDB 1.x](https://docs.influxdata.com/influxdb/v1.8/introduction/install/)
22-
- [Grafana](https://grafana.com/docs/)
23+
- [InfluxDB 1.x](https://www.influxdata.com/products/influxdb/)
24+
- [Grafana](https://grafana.com/)
2325
- A [Ruby On Rails](https://rubyonrails.org/) application with [influxdb-rails](https://github.com/influxdata/influxdb-rails) enabled
2426

2527
## Installation
2628

27-
Once you have influx/grafana instances running in your infrastructure just [import both
28-
dashboards from grafana](https://grafana.com/docs/reference/export_import/#importing-a-dashboard).
29+
Once you have influx/grafana instances running in your infrastructure just [import the
30+
dashboards from grafana.com](https://grafana.com/docs/reference/export_import/#importing-a-dashboard).
2931

30-
- [Overview Dashboard](https://grafana.com/dashboards/10428)
31-
- [Request Dashboard](https://grafana.com/dashboards/10429)
32+
- [Ruby On Rails Performance Overview](https://grafana.com/dashboards/10428/)
33+
- Performance insights into individual requests, see [Ruby On Rails Performance per Request](https://grafana.com/dashboards/10429/)
34+
- Performance of individual actions, see [Ruby On Rails Performance per Action](https://grafana.com/grafana/dashboards/11031)
35+
- [Ruby On Rails Health Overview](https://grafana.com/grafana/dashboards/14115)
36+
- [Ruby on Rails ActiveJob Overview](https://grafana.com/grafana/dashboards/14116)
37+
- [Ruby on Rails Slowlog by Request](https://grafana.com/grafana/dashboards/14118)
38+
- [Ruby on Rails Slowlog by Action](https://grafana.com/grafana/dashboards/14117)
39+
- [Ruby on Rails Slowlog by SQL](https://grafana.com/grafana/dashboards/14119)
3240

3341
You can also paste the `.json` files from this repository.
3442

35-
In the unlikely case that you need to change the dashboard *UID*s during import you can configure the *UID* the `Overview` dashboard uses to link to the `Request` dashboard in the [variables](https://grafana.com/docs/reference/templating/#adding-a-variable). Just paste whatever *UID* you've set up for the `Request` dashboard.
36-
3743
## Demo
3844

3945
This repository includes a [docker-compose](https://docs.docker.com/compose/) demo setup that brings a simple rails app, influxdb and grafana.
@@ -54,19 +60,6 @@ Go to http://0.0.0.0:4000 and do some things. Every request to the rails app wil
5460

5561
You can also use the dashboard with any other rails app you already have. Follow our [install instructions](https://github.com/influxdata/influxdb-rails/#installation), the default configuration works with the demo InfluxDB running on localhost:8086.
5662

57-
To be able to view individual requests you have to enable request ID tags in your application. Something like:
58-
59-
```ruby
60-
class ApplicationController < ActionController::Base
61-
62-
before_action :set_influx_data
63-
64-
def set_influx_data
65-
InfluxDB::Rails.current.values = { request: request.request_id }
66-
end
67-
end
68-
```
69-
7063
### ...then see the dashboards in action
7164

7265
Just go to http://0.0.0.0:3000 and log in with admin/admin.

sample-dashboard/Rakefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ task default: %w[prepare]
22

33
# rubocop:disable Layout/LineLength
44
task :prepare do
5-
sh "cat 'Ruby On Rails Performance.json' | sed 's/${DS_INFLUXDB}/InfluxDB/g' > provisioning/performance.json"
6-
sh "cat 'Ruby On Rails Performance (per Request).json' | sed 's/${DS_INFLUXDB}/InfluxDB/g' > provisioning/performance-request.json"
7-
sh "cat 'Ruby On Rails Performance (per Action).json' | sed 's/${DS_INFLUXDB}/InfluxDB/g' > provisioning/performance-action.json"
5+
sh "cat 'Ruby On Rails Performance.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/performance.json"
6+
sh "cat 'Ruby On Rails Performance per Request.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/performance-request.json"
7+
sh "cat 'Ruby On Rails Performance per Action.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/performance-action.json"
8+
sh "cat 'Ruby On Rails ActiveJob.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/activejob.json"
9+
sh "cat 'Ruby On Rails Requests.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/requests.json"
10+
sh "cat 'Ruby On Rails Slowlog by Action.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/slowlog-action.json"
11+
sh "cat 'Ruby On Rails Slowlog by Request.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/slowlog-requests.json"
12+
sh "cat 'Ruby On Rails Slowlog by SQL.json' | sed 's/${DS_INFLUXDB-RAILS}/InfluxDB/g' > provisioning/slowlog-sql.json"
813
end
914
# rubocop:enable Layout/LineLength

0 commit comments

Comments
 (0)