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
Show file tree
Hide file tree
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: 3 additions & 0 deletions plotmanager/library/utilities/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
from plotmanager.library.utilities.print import print_view, print_json
from plotmanager.library.utilities.processes import is_windows, get_manager_processes, get_running_plots, \
start_process, identify_drive, get_system_drives
from plotmanager.library.utilities.globals import IS_MANAGER


def start_manager():
global IS_MANAGER
IS_MANAGER = True
if get_manager_processes():
raise ManagerError('Manager is already running.')

Expand Down
1 change: 1 addition & 0 deletions plotmanager/library/utilities/globals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IS_MANAGER = False
5 changes: 4 additions & 1 deletion plotmanager/library/utilities/instrumentation.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import socket
import logging

from plotmanager.library.utilities.globals import IS_MANAGER

PROCESSED = False
GAUGE_PLOTS_RUNNING = None
COUNTER_PLOTS_COMPLETED = None


def _get_metrics(instrumentation_settings):
global PROCESSED
if instrumentation_settings.get('prometheus_enabled', False) and not PROCESSED:
global IS_MANAGER
if instrumentation_settings.get('prometheus_enabled', False) and not PROCESSED and IS_MANAGER:
from prometheus_client import Counter, Gauge, start_http_server
global GAUGE_PLOTS_RUNNING
global COUNTER_PLOTS_COMPLETED
Expand Down