Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: add option metrics.addr for ipv6 support #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mautrix/util/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def start_prometheus(self) -> None:
try:
enabled = self.config["metrics.enabled"]
listen_port = self.config["metrics.listen_port"]
addr = self.config.get("metrics.addr", "0.0.0.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using these values here, I think we need to have corresponding copys in mautrix/bridge/config.py. See https://github.com/mautrix/twitter/blob/master/mautrix_twitter/config.py#L48-L49 for an example of what it should look like.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right, didn't notice because I think I don't use that part.
Will update accordingly later:)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sumnerevans OK, I confused a few things when I read your comment, apologies!
I already did that for the bridge I've been using, namely mautrix/telegram#955. In fact, I'm already using that productively, so this code is not untested :)
Do you want me to file fixup PRs for the other python bridges or is it OK for you to update when bumping mautrix/python there? If so, are all bridges to update in this org?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what should be done here, @tulir ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @tulir

except KeyError:
return
if not enabled:
Expand All @@ -197,7 +198,7 @@ def start_prometheus(self) -> None:
"Metrics are enabled in config, but prometheus_client is not installed"
)
return
prometheus.start_http_server(listen_port)
prometheus.start_http_server(listen_port, addr=addr)

def _run(self) -> None:
signal.signal(signal.SIGINT, signal.default_int_handler)
Expand Down