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
1diff --git a/layer.yaml b/layer.yaml
2index 6a7e8dc..bb61bd1 100644
3--- a/layer.yaml
4+++ b/layer.yaml
5@@ -2,6 +2,7 @@ includes:
6 - layer:basic
7 - layer:nagios
8 - layer:status
9+ - interface:input-prometheus
10 repo: lp:content-cache-charm
11 options:
12 basic:
13diff --git a/metadata.yaml b/metadata.yaml
14index a3b5a01..ca7a3c8 100644
15--- a/metadata.yaml
16+++ b/metadata.yaml
17@@ -20,3 +20,6 @@ provides:
18 haproxy-statistics:
19 interface: statistics
20 scope: container
21+ nginx-prometheus-exporter:
22+ interface: input-prometheus
23+ scope: container
24diff --git a/reactive/content_cache.py b/reactive/content_cache.py
25index e40c284..24b70c4 100644
26--- a/reactive/content_cache.py
27+++ b/reactive/content_cache.py
28@@ -382,6 +382,16 @@ def advertise_stats_endpoint():
29 rel.local['password'] = password
30
31
32+@reactive.when('content_cache.nginx.configured')
33+@reactive.when('input-prometheus.available')
34+def advertise_input_prometheus_urls():
35+ rels = context.Relations()
36+
37+ for rel in rels['input-prometheus'].values():
38+ rel.local['private-address'] = hookenv.unit_private_ip()
39+ rel.local['port'] = nginx.METRICS_PORT
40+
41+
42 @reactive.when('haproxy-statistics.available')
43 @reactive.when('nrpe-external-master.available')
44 @reactive.when_not('nagios-nrpe-telegraf.configured')

Subscribers

People subscribed via source and target branches