Merge ~sajoupa/charm-telegraf:prometheus-client-default-port-9103 into charm-telegraf:master

Proposed by Barry Price
Status: Superseded
Proposed branch: ~sajoupa/charm-telegraf:prometheus-client-default-port-9103
Merge into: charm-telegraf:master
Prerequisite: ~barryprice/charm-telegraf:split_prometheus_client_config
Diff against target: 46 lines (+9/-4)
2 files modified
src/reactive/telegraf.py (+6/-1)
src/tests/unit/test_telegraf.py (+3/-3)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Canonical IS Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+398219@code.launchpad.net

This proposal supersedes a proposal from 2021-01-27.

This proposal has been superseded by a proposal from 2021-02-18.

Commit message

when related with prometheus-client, if prometheus_output_port is unset, use :9103 by default instead of 9126

To post a comment you must log in.
Revision history for this message
Laurent Sesquès (sajoupa) wrote : Posted in a previous version of this proposal
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : Posted in a previous version of this proposal

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

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : Posted in a previous version of this proposal

Unable to determine commit message from repository - please click "Set commit message" and enter the commit message manually.

Revision history for this message
Haw Loeung (hloeung) wrote : Posted in a previous version of this proposal

LGTM

review: Approve (+1)
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
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change cannot be self approved, setting status to needs review.

Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Failed to merge change (unable to merge source repository due to conflicts), setting status to needs review.

Unmerged commits

ea55458... by Laurent Sesquès

when related with prometheus-client, if prometheus_output_port is unset, use :9103 by default instead of 9126

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/reactive/telegraf.py b/src/reactive/telegraf.py
index 82cf10e..a17ceea 100644
--- a/src/reactive/telegraf.py
+++ b/src/reactive/telegraf.py
@@ -1269,7 +1269,12 @@ def configure_prometheus_client_with_relation(prometheus):
1269 "Configuring prometheus_client output plugin, with prometheus-client relation",1269 "Configuring prometheus_client output plugin, with prometheus-client relation",
1270 level=hookenv.DEBUG,1270 level=hookenv.DEBUG,
1271 )1271 )
1272 port = get_prometheus_port() or "9126"1272 if get_prometheus_port():
1273 port = get_prometheus_port()
1274 else:
1275 # We have a relation with prometheus, but removed the port number config.
1276 # Default to 9103.
1277 port = "9103"
1273 # We'll iterate through the prometheus-client relation counterparts,1278 # We'll iterate through the prometheus-client relation counterparts,
1274 # inform them of our address so that they scrape it, and get their egress subnets1279 # inform them of our address so that they scrape it, and get their egress subnets
1275 # so that we can allow them1280 # so that we can allow them
diff --git a/src/tests/unit/test_telegraf.py b/src/tests/unit/test_telegraf.py
index d1ecd6b..433a03e 100644
--- a/src/tests/unit/test_telegraf.py
+++ b/src/tests/unit/test_telegraf.py
@@ -837,7 +837,7 @@ outputs:
837 namedrop = ["aerospike*"]837 namedrop = ["aerospike*"]
838 [outputs.prometheus_client.tagpass]838 [outputs.prometheus_client.tagpass]
839 cpu = ["cpu0"]"""839 cpu = ["cpu0"]"""
840 config_file = os.path.join(base_dir(), "telegraf.d", "prometheus_client.conf")840 config_file = base_dir().join("telegraf.d", "prometheus_client.conf")
841 assert expected in config_file.read()841 assert expected in config_file.read()
842842
843843
@@ -1150,14 +1150,14 @@ def test_prometheus_client_output(mocker, monkeypatch, config):
1150 telegraf.configure_prometheus_client_with_relation(interface)1150 telegraf.configure_prometheus_client_with_relation(interface)
1151 expected = """1151 expected = """
1152 [[outputs.prometheus_client]]1152 [[outputs.prometheus_client]]
1153 listen = ":9126"1153 listen = ":9103"
1154"""1154"""
1155 assert (1155 assert (
1156 configs_dir().join("prometheus_client.conf").read().strip() == expected.strip()1156 configs_dir().join("prometheus_client.conf").read().strip() == expected.strip()
1157 )1157 )
1158 network_get_primary_address.assert_called_once_with("prometheus-client")1158 network_get_primary_address.assert_called_once_with("prometheus-client")
1159 interface.configure.assert_called_once_with(1159 interface.configure.assert_called_once_with(
1160 "9126", hostname="foo", private_address="foo"1160 "9103", hostname="foo", private_address="foo"
1161 )1161 )
11621162
11631163

Subscribers

People subscribed via source and target branches

to all changes: