Stop sub-classing object (#8249)

This commit is contained in:
Patrick Cloke 2020-09-04 06:54:56 -04:00 committed by GitHub
parent 9f8abdcc38
commit c619253db8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
168 changed files with 293 additions and 292 deletions

View file

@ -51,7 +51,7 @@ all_gauges = {} # type: Dict[str, Union[LaterGauge, InFlightGauge, BucketCollec
HAVE_PROC_SELF_STAT = os.path.exists("/proc/self/stat")
class RegistryProxy(object):
class RegistryProxy:
@staticmethod
def collect():
for metric in REGISTRY.collect():
@ -60,7 +60,7 @@ class RegistryProxy(object):
@attr.s(hash=True)
class LaterGauge(object):
class LaterGauge:
name = attr.ib(type=str)
desc = attr.ib(type=str)
@ -100,7 +100,7 @@ class LaterGauge(object):
all_gauges[self.name] = self
class InFlightGauge(object):
class InFlightGauge:
"""Tracks number of things (e.g. requests, Measure blocks, etc) in flight
at any given time.
@ -206,7 +206,7 @@ class InFlightGauge(object):
@attr.s(hash=True)
class BucketCollector(object):
class BucketCollector:
"""
Like a Histogram, but allows buckets to be point-in-time instead of
incrementally added to.
@ -269,7 +269,7 @@ class BucketCollector(object):
#
class CPUMetrics(object):
class CPUMetrics:
def __init__(self):
ticks_per_sec = 100
try:
@ -329,7 +329,7 @@ gc_time = Histogram(
)
class GCCounts(object):
class GCCounts:
def collect(self):
cm = GaugeMetricFamily("python_gc_counts", "GC object counts", labels=["gen"])
for n, m in enumerate(gc.get_count()):
@ -347,7 +347,7 @@ if not running_on_pypy:
#
class PyPyGCStats(object):
class PyPyGCStats:
def collect(self):
# @stats is a pretty-printer object with __str__() returning a nice table,
@ -482,7 +482,7 @@ build_info.labels(
last_ticked = time.time()
class ReactorLastSeenMetric(object):
class ReactorLastSeenMetric:
def collect(self):
cm = GaugeMetricFamily(
"python_twisted_reactor_last_seen",