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

Check for Prometheus running in manager state #660

Closed
wants to merge 7 commits into from
Closed

Check for Prometheus running in manager state #660

wants to merge 7 commits into from

Conversation

iwex
Copy link

@iwex iwex commented May 21, 2021

No description provided.

@iwex iwex changed the title Iwex patch 1 Check for Prometheus running in manager state May 21, 2021
@iwex iwex closed this May 21, 2021
@iwex
Copy link
Author

iwex commented May 21, 2021

Not working 😄

@iwex iwex reopened this May 21, 2021
@iwex
Copy link
Author

iwex commented May 21, 2021

Tried to fix, and now seem like it's working

@salsaly4
Copy link

Sorry for previous comment, found that the problem was in prometheus-client exposition implementation.

Is it simpler to check for socket like this:

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if sock.bind(('127.0.0.1', port)):
    sock.close()
    start_http_server(port)

@salsaly4
Copy link

Or even more simpler:

try:
    start_http_server(port)
except:
    pass

@creamsoup
Copy link

the prometheus client should be only running by manager daemon. other commands like view, json etc shoulnd't even start prometheus client. if two manager.py with same config is running, this is legit error. so, skipping exception or port being used is not the best solution. seems global is the better solution but global is bad.
I solved this in #824 (pretty much same idea). please comment in the PR if you don't agree.

@iwex iwex closed this Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants