Skip to content

Commit 3c77062

Browse files
authored
Merge pull request #98 from virtUOS/remove-old-metrics-exporter
Remove old metrics exporter
2 parents 9586c5d + 00098ca commit 3c77062

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

occameracontrol/__main__.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from occameracontrol.agent import Agent
2727
from occameracontrol.camera import Camera
28-
from occameracontrol.metrics import start_metrics_exporter, RequestErrorHandler
28+
from occameracontrol.metrics import RequestErrorHandler
2929

3030
from occameracontrol.camera_control_server import start_camera_control_server
3131

@@ -134,9 +134,6 @@ def main():
134134
threads.append(control_thread)
135135
control_thread.start()
136136

137-
# Start delivering metrics
138-
start_metrics_exporter()
139-
140137
# Start camera control server
141138
auth = (config_rt(str, 'basic_auth', 'username'),
142139
config_rt(str, 'basic_auth', 'password'))

occameracontrol/metrics.py

-25
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
import requests
1919
import time
2020

21-
from confygure import config_t
2221
from prometheus_client import Counter, Gauge
23-
from prometheus_client import start_http_server
2422

2523

2624
logger = logging.getLogger(__name__)
@@ -118,26 +116,3 @@ def register_camera_expectation(camera: str, position: int):
118116
:param position: New camera position
119117
'''
120118
camera_position_expected.labels(camera).set(position)
121-
122-
123-
def start_metrics_exporter():
124-
'''Start the web server for the metrics exporter endpoint if it is enabled
125-
in the configuration.
126-
'''
127-
if not config_t(bool, 'metrics', 'enabled'):
128-
return
129-
130-
supported_args = start_http_server.__code__.co_varnames
131-
if 'certfile' in supported_args:
132-
start_http_server(
133-
port=config_t(int, 'metrics', 'port') or 8000,
134-
addr=config_t(str, 'metrics', 'addr') or '127.0.0.1',
135-
certfile=config_t(str, 'metrics', 'certfile'),
136-
keyfile=config_t(str, 'metrics', 'keyfile'))
137-
else:
138-
if config_t(str, 'metrics', 'certfile'):
139-
logger.warn('Old version of Prometheus client library does not yet'
140-
' support TLS. Provided certificate will be ignored.')
141-
start_http_server(
142-
port=config_t(int, 'metrics', 'port') or 8000,
143-
addr=config_t(str, 'metrics', 'addr') or '127.0.0.1')

0 commit comments

Comments
 (0)