Merge ~afreiberger/charm-telegraf:ignore_rdt_on_virt into charm-telegraf:master

Proposed by Drew Freiberger
Status: Merged
Approved by: James Troup
Approved revision: 9f5bada0b8d7ba21f28541ca1f98618188188c65
Merged at revision: 26e531a9977502432350306c681f186191fd1084
Proposed branch: ~afreiberger/charm-telegraf:ignore_rdt_on_virt
Merge into: charm-telegraf:master
Diff against target: 66 lines (+10/-6)
1 file modified
src/reactive/telegraf.py (+10/-6)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack continuous-integration Approve
James Troup (community) Approve
Canonical IS Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+409451@code.launchpad.net

Commit message

Don't add rdt metrics section to base_inputs.conf if virtual

To post a comment you must log in.
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 :

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 :

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

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

LGTM, will approve once CI is done.

review: Approve
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 26e531a9977502432350306c681f186191fd1084

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 a5a634d..9c63383 100644
3--- a/src/reactive/telegraf.py
4+++ b/src/reactive/telegraf.py
5@@ -111,6 +111,11 @@ class InvalidIntelRDTConfigurationError(Exception):
6 pass
7
8
9+def is_intel_rdt_enabled():
10+ config = hookenv.config()
11+ return config.get("collect_intel_rdt_metrics", False) and is_metal()
12+
13+
14 def write_telegraf_file(path, content):
15 return host.write_file(
16 path,
17@@ -438,7 +443,7 @@ def get_base_inputs():
18 disabled_plugins = get_disabled_plugins()
19
20 # handle the Intel RDT collection parameters
21- intel_rdt = config["collect_intel_rdt_metrics"]
22+ intel_rdt = is_intel_rdt_enabled()
23 if intel_rdt:
24 intel_rdt_cores = get_cpu_cores()
25 else:
26@@ -820,7 +825,7 @@ def configure_telegraf(): # noqa: C901
27 # handle the configuration of intel_rdt
28 sudoers_filename = "telegraf_intel_rdt"
29 # Don't load bits for RDT on VM or Containers
30- if config["collect_intel_rdt_metrics"] and is_metal():
31+ if is_intel_rdt_enabled():
32 hookenv.log("Intel RDT enabled, enabling module and running checks")
33 # load and persist the required module
34 try:
35@@ -872,7 +877,7 @@ def configure_telegraf(): # noqa: C901
36 # skip reload when Intel RDT is enabled, as it stops the plugin from
37 # publishing data. The service will be restarted via the flag
38 # "telegraf.needs_reload" on changes later
39- if not config["collect_intel_rdt_metrics"]:
40+ if not is_intel_rdt_enabled():
41 hookenv.log("reloading service: {}".format(service), level="DEBUG")
42 host.service_reload(service)
43 else:
44@@ -1003,7 +1008,7 @@ def handle_config_changes():
45 clear_flag("prometheus-client.relation.configured")
46
47 # handle the Intel RDT/MBM metrics collection
48- if config.get("collect_intel_rdt_metrics"):
49+ if is_intel_rdt_enabled():
50 set_flag("telegraf.intel_rdt.enabled")
51 else:
52 clear_flag("telegraf.intel_rdt.enabled")
53@@ -1719,12 +1724,11 @@ def prometheus_client_departed():
54 )
55 @when_not("grafana.configured")
56 def register_grafana_dashboard():
57- config = hookenv.config()
58 grafana = endpoint_from_flag("endpoint.dashboards.joined")
59 grafana_dashboard_config = GRAFANA_DASHBOARD_CONFIG.copy()
60
61 # if RDT is enabled inject the relevant dashboard config
62- if config["collect_intel_rdt_metrics"]:
63+ if is_intel_rdt_enabled():
64 grafana_dashboard_config["Intel RDT"] = {"template_file": "IntelRDT.json.j2"}
65
66 # process all the configured dashboards

Subscribers

People subscribed via source and target branches

to all changes: