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

Proposed by Laurent Sesquès
Status: Superseded
Proposed branch: ~sajoupa/charm-telegraf:prometheus-client-default-port-9103
Merge into: charm-telegraf:master
Prerequisite: ~sajoupa/charm-telegraf:split_prometheus_client_config
Diff against target: 34 lines (+4/-4)
2 files modified
src/reactive/telegraf.py (+2/-2)
src/tests/unit/test_telegraf.py (+2/-2)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
BootStack Reviewers Pending
Review via email: mp+397005@code.launchpad.net

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 :
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 :

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 :

LGTM

review: Approve (+1)

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

3c4a87e... by Laurent Sesquès

small fix: move flag changes to the right if stanza for config.changed

f550c15... by Laurent Sesquès

Split prometheus_client output config out of the main config file. Allow a prometheus-client relation to prometheus even if prometheus_output_port is set (and use that port in the relation).

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 e2c0874..92998c7 100644
--- a/src/reactive/telegraf.py
+++ b/src/reactive/telegraf.py
@@ -1249,8 +1249,8 @@ def configure_prometheus_client_with_relation(prometheus):
1249 port = get_prometheus_port()1249 port = get_prometheus_port()
1250 else:1250 else:
1251 # We have a relation with prometheus, but removed the port number config.1251 # We have a relation with prometheus, but removed the port number config.
1252 # Default to 9126.1252 # Default to 9103.
1253 port = "9126"1253 port = "9103"
1254 # We'll iterate through the prometheus-client relation counterparts,1254 # We'll iterate through the prometheus-client relation counterparts,
1255 # inform them of our address so that they scrape it, and get their egress subnets1255 # inform them of our address so that they scrape it, and get their egress subnets
1256 # so that we can allow them1256 # so that we can allow them
diff --git a/src/tests/unit/test_telegraf.py b/src/tests/unit/test_telegraf.py
index 09e1575..9fcb1b3 100644
--- a/src/tests/unit/test_telegraf.py
+++ b/src/tests/unit/test_telegraf.py
@@ -1094,14 +1094,14 @@ def test_prometheus_client_output(mocker, monkeypatch, config):
1094 telegraf.configure_prometheus_client_with_relation(interface)1094 telegraf.configure_prometheus_client_with_relation(interface)
1095 expected = """1095 expected = """
1096 [[outputs.prometheus_client]]1096 [[outputs.prometheus_client]]
1097 listen = ":9126"1097 listen = ":9103"
1098"""1098"""
1099 assert (1099 assert (
1100 configs_dir().join("prometheus_client.conf").read().strip() == expected.strip()1100 configs_dir().join("prometheus_client.conf").read().strip() == expected.strip()
1101 )1101 )
1102 network_get_primary_address.assert_called_once_with("prometheus-client")1102 network_get_primary_address.assert_called_once_with("prometheus-client")
1103 interface.configure.assert_called_once_with(1103 interface.configure.assert_called_once_with(
1104 "9126", hostname="foo", private_address="foo"1104 "9103", hostname="foo", private_address="foo"
1105 )1105 )
11061106
11071107

Subscribers

People subscribed via source and target branches

to all changes: