Skip to content
Snippets Groups Projects
Unverified Commit d3ba6975 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Also set up retention policies

parent e1ce5719
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -30,9 +30,14 @@ Next, make sure you have the following details of your InfluxDB database:
* The database name (usually "gitlab")
 
These details are needed to connect to the InfluxDB database. Note that the user
must be able to execute the `CREATE CONTINUOUS QUERY` and `DROP CONTINUOUS
QUERY` commands. Once you have these details you'll need to set up a
configuration file. To do so, run the following command:
must be able to execute the following commands:
* `CREATE CONTINUOUS QUERY`
* `DROP CONTINUOUS QUERY`
* `CREATE RETENTION POLICY`
Once you have these details you'll need to set up a configuration file. To do
so, run the following command:
 
cp .env.example .env
 
Loading
Loading
@@ -41,10 +46,10 @@ variables in this file contain the correct values.
 
## Usage
 
Once configured you can set up the continuous queries by running the following
command:
Once configured you can set up the retention policies, continuous queries, etc
by running the following command:
 
bundle exec rake queries
bundle exec rake
 
## Structure
 
Loading
Loading
Loading
Loading
@@ -13,6 +13,12 @@ CLIENT = InfluxDB::Client.new(
 
QUERIES = File.expand_path('../queries', __FILE__)
 
desc 'Sets up the retention policies'
task :policies do
CLIENT.query('CREATE RETENTION POLICY "default" ON gitlab DURATION 1h REPLICATION 1 DEFAULT')
CLIENT.query('CREATE RETENTION POLICY downsampled ON gitlab DURATION 7d REPLICATION 1')
end
desc 'Updates the continuous queries in the database'
task :queries do
db = ENV.fetch('INFLUX_DATABASE')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment