Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: scripts/master/monitoring_status_receiver.py

Issue 2255333002: Revert of Re-land "Make Buildbot masters send ts_mon metrics, and add standard HTTP server metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from buildbot.status.base import StatusReceiverMultiService
6 from twisted.internet import task
7 from twisted.python import log, threadpool
8
9 from infra_libs import ts_mon
10
11
12 class MonitoringStatusReceiver(StatusReceiverMultiService):
13 """Flushes ts_mon metrics once per minute."""
14
15 def __init__(self):
16 StatusReceiverMultiService.__init__(self)
17 self.status = None
18 self.thread_pool = threadpool.ThreadPool(1, 1)
19 self.loop = task.LoopingCall(self._flush)
20
21 def startService(self):
22 StatusReceiverMultiService.startService(self)
23 self.status = self.parent.getStatus()
24 self.status.subscribe(self)
25
26 self.thread_pool.start()
27 self.loop.start(60, now=False)
28
29 def stopService(self):
30 self.loop.stop()
31 self.thread_pool.stop()
32 return StatusReceiverMultiService.stopService(self)
33
34 def _flush(self):
35 self.thread_pool.callInThread(self._flush_and_log_exceptions)
36
37 def _flush_and_log_exceptions(self):
38 try:
39 ts_mon.flush()
40 except Exception:
41 log.err(None, 'Automatic monitoring flush failed.')
OLDNEW
« no previous file with comments | « scripts/master/master_utils.py ('k') | third_party/buildbot_8_4p1/buildbot/status/web/baseweb.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698