Mercurial > code > home > repos > light9
comparison bin/patchserver @ 2046:9aa046cc9b33
replace greplin with prometheus throughout (untested)
author | drewp@bigasterisk.com |
---|---|
date | Tue, 10 May 2022 23:01:26 -0700 |
parents | 3d28b1a54a29 |
children |
comparison
equal
deleted
inserted
replaced
2045:ce32d00263a6 | 2046:9aa046cc9b33 |
---|---|
10 import optparse | 10 import optparse |
11 import os | 11 import os |
12 import time | 12 import time |
13 import treq | 13 import treq |
14 import cyclone.web, cyclone.websocket, cyclone.httpclient | 14 import cyclone.web, cyclone.websocket, cyclone.httpclient |
15 from greplin import scales | |
16 | 15 |
17 from cycloneerr import PrettyErrorHandler | 16 from cycloneerr import PrettyErrorHandler |
18 | 17 |
19 from light9.namespaces import L9, RDF | 18 from light9.namespaces import L9, RDF |
20 from light9 import networking, showconfig | 19 from light9 import networking, showconfig |
21 from rdfdb.syncedgraph import SyncedGraph | 20 from rdfdb.syncedgraph import SyncedGraph |
22 | 21 |
23 from greplin.scales.cyclonehandler import StatsHandler | |
24 from light9.effect.settings import DeviceSettings | 22 from light9.effect.settings import DeviceSettings |
25 from rdfdb.patch import Patch | 23 from rdfdb.patch import Patch |
24 from light9.metrics import metrics, metricsRoute | |
26 | 25 |
27 stats = scales.collection('/webServer', scales.PmfStat('setAttr', | |
28 recalcPeriod=1)) | |
29 | 26 |
30 | 27 |
31 def launch(graph): | 28 def launch(graph): |
32 if 0: | 29 if 0: |
33 reactor.listenTCP( | 30 reactor.listenTCP( |
35 cyclone.web.Application(handlers=[ | 32 cyclone.web.Application(handlers=[ |
36 (r'/()', cyclone.web.StaticFileHandler, { | 33 (r'/()', cyclone.web.StaticFileHandler, { |
37 "path": "light9/web", | 34 "path": "light9/web", |
38 "default_filename": "patchServer.html" | 35 "default_filename": "patchServer.html" |
39 }), | 36 }), |
40 (r'/stats/(.*)', StatsHandler, { | 37 metricsRoute(), |
41 'serverName': 'patchServer' | |
42 }), | |
43 ]), | 38 ]), |
44 interface='::', | 39 interface='::', |
45 ) | 40 ) |
46 log.info('serving http on %s', networking.captureDevice.port) | 41 log.info('serving http on %s', networking.captureDevice.port) |
47 | 42 |