Merge ~ballot/content-cache-charm/+git/content-cache-charm:add_relations into content-cache-charm:master

Proposed by Benjamin Allot
Status: Work in progress
Proposed branch: ~ballot/content-cache-charm/+git/content-cache-charm:add_relations
Merge into: content-cache-charm:master
Diff against target: 44 lines (+14/-0)
3 files modified
layer.yaml (+1/-0)
metadata.yaml (+3/-0)
reactive/content_cache.py (+10/-0)
Reviewer Review Type Date Requested Status
Content Cache Charmers Pending
Review via email: mp+373539@code.launchpad.net
To post a comment you must log in.

Unmerged commits

4a57101... by Benjamin Allot

Add an endpoint exposing the url for nginx metrics.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/layer.yaml b/layer.yaml
index 6a7e8dc..bb61bd1 100644
--- a/layer.yaml
+++ b/layer.yaml
@@ -2,6 +2,7 @@ includes:
2 - layer:basic2 - layer:basic
3 - layer:nagios3 - layer:nagios
4 - layer:status4 - layer:status
5 - interface:input-prometheus
5repo: lp:content-cache-charm6repo: lp:content-cache-charm
6options:7options:
7 basic:8 basic:
diff --git a/metadata.yaml b/metadata.yaml
index a3b5a01..ca7a3c8 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -20,3 +20,6 @@ provides:
20 haproxy-statistics:20 haproxy-statistics:
21 interface: statistics21 interface: statistics
22 scope: container22 scope: container
23 nginx-prometheus-exporter:
24 interface: input-prometheus
25 scope: container
diff --git a/reactive/content_cache.py b/reactive/content_cache.py
index e40c284..24b70c4 100644
--- a/reactive/content_cache.py
+++ b/reactive/content_cache.py
@@ -382,6 +382,16 @@ def advertise_stats_endpoint():
382 rel.local['password'] = password382 rel.local['password'] = password
383383
384384
385@reactive.when('content_cache.nginx.configured')
386@reactive.when('input-prometheus.available')
387def advertise_input_prometheus_urls():
388 rels = context.Relations()
389
390 for rel in rels['input-prometheus'].values():
391 rel.local['private-address'] = hookenv.unit_private_ip()
392 rel.local['port'] = nginx.METRICS_PORT
393
394
385@reactive.when('haproxy-statistics.available')395@reactive.when('haproxy-statistics.available')
386@reactive.when('nrpe-external-master.available')396@reactive.when('nrpe-external-master.available')
387@reactive.when_not('nagios-nrpe-telegraf.configured')397@reactive.when_not('nagios-nrpe-telegraf.configured')

Subscribers

People subscribed via source and target branches