Merge ~xavpaice/charm-telegraf:bug/1939262 into charm-telegraf:master

Proposed by Xav Paice
Status: Merged
Approved by: James Troup
Approved revision: d738bc1f755d0a09809efc50b8f88c3753401ae5
Merged at revision: b86854b23d52cec19f7f05a17c0af995a42db7b9
Proposed branch: ~xavpaice/charm-telegraf:bug/1939262
Merge into: charm-telegraf:master
Diff against target: 86 lines (+7/-15)
4 files modified
src/reactive/telegraf.py (+5/-4)
src/tests/functional/tests/bundles/bionic-monitoring.yaml (+0/-4)
src/tests/functional/tests/bundles/focal-compute.yaml (+0/-2)
src/tests/functional/tests/test_telegraf.py (+2/-5)
Reviewer Review Type Date Requested Status
prod-jenkaas-bootstack (community) continuous-integration Approve
Paul Goins Approve
Celia Wang Approve
BootStack Reviewers Pending
James Troup Pending
Canonical IS Reviewers Pending
Review via email: mp+407427@code.launchpad.net

Commit message

Allow Telegraf to relate to multiple Prometheus applications.

To post a comment you must log in.
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Celia Wang (ziyiwang) wrote :

lgtm

review: Approve
Revision history for this message
James Troup (elmo) wrote :

Setting back to WIP as discussed; please investigate CI failure?

Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Paul Goins (vultaire) wrote :

LGTM, +1.

review: Approve
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision b86854b23d52cec19f7f05a17c0af995a42db7b9

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/reactive/telegraf.py b/src/reactive/telegraf.py
2index 137d4d8..6732ef1 100644
3--- a/src/reactive/telegraf.py
4+++ b/src/reactive/telegraf.py
5@@ -1577,8 +1577,7 @@ def render_prometheus_client_config(port, ip_range):
6 )
7
8
9-@when("prometheus-client.available")
10-@when_not("prometheus-client.relation.configured")
11+@when("endpoint.prometheus-client.changed")
12 def configure_prometheus_client_with_relation(prometheus):
13 hookenv.log(
14 "Configuring prometheus_client output plugin, with prometheus-client relation",
15@@ -1624,9 +1623,9 @@ def configure_prometheus_client_with_relation(prometheus):
16 set_flag("plugins.prometheus-client.configured")
17 set_flag("prometheus-client.relation.configured")
18 set_flag("telegraf.needs_reload")
19+ clear_flag("endpoint.prometheus-client.changed") # not automatic
20
21
22-@when_not("prometheus-client.available")
23 @when_not("plugins.prometheus-client.configured")
24 def configure_prometheus_client():
25 hookenv.log("Configuring prometheus_client output plugin", level=hookenv.DEBUG)
26@@ -1670,7 +1669,9 @@ def convert_days(time_string):
27 return str(days)
28
29
30-@when("prometheus-rules.available")
31+# use @hook because the prometheus-rules interface is based on RelationBase, which
32+# does not populate the endpoint.* flags
33+@hook("prometheus-rules-relation-changed")
34 def render_prometheus_rules(prometheus_rules):
35 # Send a list of rules for alerting to Prometheus
36 config = hookenv.config()
37diff --git a/src/tests/functional/tests/bundles/bionic-monitoring.yaml b/src/tests/functional/tests/bundles/bionic-monitoring.yaml
38index b42b9df..05491aa 100644
39--- a/src/tests/functional/tests/bundles/bionic-monitoring.yaml
40+++ b/src/tests/functional/tests/bundles/bionic-monitoring.yaml
41@@ -17,8 +17,6 @@ applications:
42 prometheus2:
43 charm: cs:prometheus2
44 num_units: 1
45- prometheus-alertmanager:
46- charm: cs:prometheus-alertmanager
47
48 relations:
49 - - percona-cluster:juju-info
50@@ -33,5 +31,3 @@ relations:
51 - telegraf:dashboards
52 - - prometheus2:prometheus-rules
53 - telegraf:prometheus-rules
54- - - prometheus2:alertmanager-service
55- - prometheus-alertmanager:alertmanager-service
56diff --git a/src/tests/functional/tests/bundles/focal-compute.yaml b/src/tests/functional/tests/bundles/focal-compute.yaml
57index ee56226..e7478ae 100644
58--- a/src/tests/functional/tests/bundles/focal-compute.yaml
59+++ b/src/tests/functional/tests/bundles/focal-compute.yaml
60@@ -30,8 +30,6 @@ applications:
61 charm: cs:~openstack-charmers-next/mysql-router
62 keystone-mysql-router:
63 charm: cs:~openstack-charmers-next/mysql-router
64- glance-mysql-router:
65- charm: cs:~openstack-charmers-next/mysql-router
66 neutron-api-mysql-router:
67 charm: cs:~openstack-charmers-next/mysql-router
68 placement-mysql-router:
69diff --git a/src/tests/functional/tests/test_telegraf.py b/src/tests/functional/tests/test_telegraf.py
70index 5e8911e..de834ed 100644
71--- a/src/tests/functional/tests/test_telegraf.py
72+++ b/src/tests/functional/tests/test_telegraf.py
73@@ -27,11 +27,8 @@ class TestTelegraf(BaseTelegrafTest):
74 def test_01_metrics_available(self):
75 # check metrics are available
76 re_patterns = [
77- r"^sockstat_",
78- r"^sockstat6_",
79- # r"^softnet_stat", # LP1913645: unavailable on container
80- # r"^buddyinfo_", # LP1913645
81- # r"^zoneinfo_", # commented because of LP1913645
82+ r"^net_",
83+ r"^process_",
84 r"^processes_",
85 ]
86 self.check_metrics(re_patterns)

Subscribers

People subscribed via source and target branches

to all changes: