update_prometheus_rules hook restarts prometheus
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Prometheus2 charm |
Fix Released
|
High
|
Stuart Bishop |
Bug Description
We are using the prometheus2 charm with relations to some custom charms we have developed.
We have prometheus-client and prometheus-rules relations, however, we have noticed that the prometheus-rules relation hook is firing every 5 minutes in our custom charm.
Our custom charm runs this:
@when('
def render_
# Send a list of rules for alerting to Prometheus
formatted_rules = []
template_files = glob.glob(
for template_file in template_files:
with open(template_file, 'r') as fd:
prometheus_
Then update_
@when('
@when('
def update_
rules = prometheus_
# insert into a template
template = """
groups:
- name: JujuRelation
rules:
{{ rules }}
"""
with open(PATHS[
set_
set_
The last line of this code forces a restart of Prometheus.
Therefore our Prometheus is restarting every 5 minutes even though the prometheus-rules aren't changing.
1. Is it correct that the prometheus-
2. Even if it does fire, why does it need to do a full Prometheus restart, isn't do-check-reconfig sufficient?
thanks,
Ed
Related branches
- Joel Sing (community): Approve (+1)
- Canonical IS Reviewers: Pending requested
-
Diff: 50 lines (+8/-2)2 files modifiedreactive/prometheus.py (+5/-2)
tox.ini (+3/-0)
Changed in prometheus2-charm: | |
status: | New → In Progress |
assignee: | nobody → Stuart Bishop (stub) |
Changed in charm-prometheus2: | |
importance: | Undecided → High |
status: | In Progress → Fix Committed |
Changed in charm-prometheus2: | |
status: | Fix Committed → Fix Released |
Prometheus2 charm version as below:
App Version Status Scale Charm Store Rev OS Notes
prometheus active 1 prometheus2 jujucharms 11 ubuntu