Merge ~hloeung/influxdb-charm:master into influxdb-charm:master

Proposed by Haw Loeung
Status: Merged
Merged at revision: ddbaf703a44fa11177a6194ceea8336768cc1aac
Proposed branch: ~hloeung/influxdb-charm:master
Merge into: influxdb-charm:master
Diff against target: 51 lines (+8/-2)
3 files modified
config.yaml (+4/-0)
reactive/influxdb.py (+3/-1)
templates/influxdb.conf (+1/-1)
Reviewer Review Type Date Requested Status
Paul Gear (community) Approve
Review via email: mp+332977@code.launchpad.net

Description of the change

Allow overriding max-series-per-database.

To post a comment you must log in.
Revision history for this message
Paul Gear (paulgear) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/config.yaml b/config.yaml
2index 88e99ce..ce9ee4a 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -75,3 +75,7 @@ options:
6 databases to the nominated directory. See
7 https://docs.influxdata.com/influxdb/v1.3/administration/backup_and_restore/
8 for more information on InfluxDB backups.
9+ max_series_per_database:
10+ type: int
11+ default: 1000000
12+ description: "Maximum series allowed per database before writes are dropped"
13diff --git a/reactive/influxdb.py b/reactive/influxdb.py
14index d7698cf..856c9bb 100644
15--- a/reactive/influxdb.py
16+++ b/reactive/influxdb.py
17@@ -33,11 +33,12 @@ def install_influx():
18 set_state('influxdb.configured')
19
20
21-@when_any('config.changed.bind_port', 'config.changed.ip_address')
22+@when_any('config.changed.bind_port', 'config.changed.ip_address', 'config.changed.max_series_per_database')
23 def config_changed():
24 config = hookenv.config()
25 port = config.get('bind_port')
26 ip_address = config.get('ip_address')
27+ max_series_per_database = config.get('max_series_per_database')
28 render(source='influxdb.conf',
29 target='/etc/influxdb/influxdb.conf',
30 owner='root',
31@@ -46,6 +47,7 @@ def config_changed():
32 'admin': 'true',
33 'bind_port': port,
34 'ip_address': ip_address,
35+ 'max_series_per_database': max_series_per_database,
36 })
37 service_stop('influxdb')
38 service_start('influxdb')
39diff --git a/templates/influxdb.conf b/templates/influxdb.conf
40index 675ce90..77ed982 100644
41--- a/templates/influxdb.conf
42+++ b/templates/influxdb.conf
43@@ -80,7 +80,7 @@
44 # The maximum series allowed per database before writes are dropped. This limit can prevent
45 # high cardinality issues at the database level. This limit can be disabled by setting it to
46 # 0.
47- # max-series-per-database = 1000000
48+ max-series-per-database = {{max_series_per_database}}
49
50 # The maximum number of tag values per tag that are allowed before writes are dropped. This limit
51 # can prevent high cardinality tag values from being written to a measurement. This limit can be

Subscribers

People subscribed via source and target branches

to all changes: