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
1diff --git a/src/reactive/telegraf.py b/src/reactive/telegraf.py
2index 82cf10e..a17ceea 100644
3--- a/src/reactive/telegraf.py
4+++ b/src/reactive/telegraf.py
5@@ -1269,7 +1269,12 @@ def configure_prometheus_client_with_relation(prometheus):
6 "Configuring prometheus_client output plugin, with prometheus-client relation",
7 level=hookenv.DEBUG,
8 )
9- port = get_prometheus_port() or "9126"
10+ if get_prometheus_port():
11+ port = get_prometheus_port()
12+ else:
13+ # We have a relation with prometheus, but removed the port number config.
14+ # Default to 9103.
15+ port = "9103"
16 # We'll iterate through the prometheus-client relation counterparts,
17 # inform them of our address so that they scrape it, and get their egress subnets
18 # so that we can allow them
19diff --git a/src/tests/unit/test_telegraf.py b/src/tests/unit/test_telegraf.py
20index d1ecd6b..433a03e 100644
21--- a/src/tests/unit/test_telegraf.py
22+++ b/src/tests/unit/test_telegraf.py
23@@ -837,7 +837,7 @@ outputs:
24 namedrop = ["aerospike*"]
25 [outputs.prometheus_client.tagpass]
26 cpu = ["cpu0"]"""
27- config_file = os.path.join(base_dir(), "telegraf.d", "prometheus_client.conf")
28+ config_file = base_dir().join("telegraf.d", "prometheus_client.conf")
29 assert expected in config_file.read()
30
31
32@@ -1150,14 +1150,14 @@ def test_prometheus_client_output(mocker, monkeypatch, config):
33 telegraf.configure_prometheus_client_with_relation(interface)
34 expected = """
35 [[outputs.prometheus_client]]
36- listen = ":9126"
37+ listen = ":9103"
38 """
39 assert (
40 configs_dir().join("prometheus_client.conf").read().strip() == expected.strip()
41 )
42 network_get_primary_address.assert_called_once_with("prometheus-client")
43 interface.configure.assert_called_once_with(
44- "9126", hostname="foo", private_address="foo"
45+ "9103", hostname="foo", private_address="foo"
46 )
47
48

Subscribers

People subscribed via source and target branches

to all changes: