Changeset - 45c89eb6dd4c
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-31 09:16:49
drewp@bigasterisk.com
no cyclone at import time. i can't even install it now
1 file changed with 0 insertions and 10 deletions:
0 comments (0 inline, 0 general)
light9/metrics.py
Show inline comments
 
@@ -19,13 +19,12 @@ form of the call to set up the right typ
 

	
 
I don't see a need for labels yet, but maybe some code will want like
 
metrics('foo', label1=one). Need histogram? Info?
 

	
 
"""
 
from typing import Dict, Tuple, Callable, Type, TypeVar, cast
 
import cyclone.web
 
from prometheus_client import Counter, Gauge, Metric, Summary
 
from prometheus_client.exposition import generate_latest
 
from prometheus_client.registry import REGISTRY
 

	
 
_created: Dict[str, Metric] = {}
 

	
 
@@ -74,21 +73,12 @@ class _MetricsRequest:
 

	
 

	
 
def metrics(name: str, **labels):
 
    return _MetricsRequest(name, **labels)
 

	
 

	
 
class _CycloneMetrics(cyclone.web.RequestHandler):
 

	
 
    def get(self):
 
        self.add_header('content-type', 'text/plain')
 
        self.write(generate_latest(REGISTRY))
 

	
 

	
 
def metricsRoute() -> Tuple[str, Type[cyclone.web.RequestHandler]]:
 
    return ('/metrics', _CycloneMetrics)
 

	
 

	
 
"""
 
stuff we used to have in greplin. Might be nice to get (client-side-computed) min/max/stddev back.
 

	
 
class PmfStat(Stat):
0 comments (0 inline, 0 general)