more cleanup

pull/3256/head
Amber Brown 2018-05-22 17:36:20 -05:00
parent 53cc2cde1f
commit b6063631c3
3 changed files with 11 additions and 9 deletions

View File

@ -21,7 +21,7 @@ import platform
import attr import attr
from prometheus_client import Gauge, Histogram, Counter from prometheus_client import Gauge, Histogram, Counter
from prometheus_client.core import GaugeMetricFamily, CounterMetricFamily, REGISTRY from prometheus_client.core import GaugeMetricFamily, REGISTRY
from twisted.internet import reactor from twisted.internet import reactor
@ -97,8 +97,6 @@ gc_time = Histogram(
class GCCounts(object): class GCCounts(object):
def collect(self): def collect(self):
gc_counts = gc.get_count()
cm = GaugeMetricFamily("python_gc_counts", "GC cycle counts", labels=["gen"]) cm = GaugeMetricFamily("python_gc_counts", "GC cycle counts", labels=["gen"])
for n, m in enumerate(gc.get_count()): for n, m in enumerate(gc.get_count()):
cm.add_metric([str(n)], m) cm.add_metric([str(n)], m)

View File

@ -197,7 +197,8 @@ class BaseReplicationStreamProtocol(LineOnlyReceiver):
self.last_received_command = self.clock.time_msec() self.last_received_command = self.clock.time_msec()
self.inbound_commands_counter[cmd_name] = self.inbound_commands_counter[cmd_name] + 1 self.inbound_commands_counter[cmd_name] = (
self.inbound_commands_counter[cmd_name] + 1)
cmd_cls = COMMAND_MAP[cmd_name] cmd_cls = COMMAND_MAP[cmd_name]
try: try:
@ -247,7 +248,8 @@ class BaseReplicationStreamProtocol(LineOnlyReceiver):
self._queue_command(cmd) self._queue_command(cmd)
return return
self.outbound_commands_counter[cmd.NAME] = self.outbound_commands_counter[cmd.NAME] + 1 self.outbound_commands_counter[cmd.NAME] = (
self.outbound_commands_counter[cmd.NAME] + 1)
string = "%s %s" % (cmd.NAME, cmd.to_line(),) string = "%s %s" % (cmd.NAME, cmd.to_line(),)
if "\n" in string: if "\n" in string:
raise Exception("Unexpected newline in command: %r", string) raise Exception("Unexpected newline in command: %r", string)
@ -632,4 +634,5 @@ tcp_outbound_commands = LaterGauge(
}) })
# number of updates received for each RDATA stream # number of updates received for each RDATA stream
inbound_rdata_count = Counter("synapse_replication_tcp_inbound_rdata_count", "", ["stream_name"]) inbound_rdata_count = Counter("synapse_replication_tcp_inbound_rdata_count", "",
["stream_name"])

View File

@ -28,12 +28,13 @@ import logging
from prometheus_client import Counter from prometheus_client import Counter
stream_updates_counter = Counter("synapse_replication_tcp_resource_stream_updates", "", ["stream_name"] stream_updates_counter = Counter("synapse_replication_tcp_resource_stream_updates",
) "", ["stream_name"])
user_sync_counter = Counter("synapse_replication_tcp_resource_user_sync", "") user_sync_counter = Counter("synapse_replication_tcp_resource_user_sync", "")
federation_ack_counter = Counter("synapse_replication_tcp_resource_federation_ack", "") federation_ack_counter = Counter("synapse_replication_tcp_resource_federation_ack", "")
remove_pusher_counter = Counter("synapse_replication_tcp_resource_remove_pusher", "") remove_pusher_counter = Counter("synapse_replication_tcp_resource_remove_pusher", "")
invalidate_cache_counter = Counter("synapse_replication_tcp_resource_invalidate_cache", "") invalidate_cache_counter = Counter("synapse_replication_tcp_resource_invalidate_cache",
"")
user_ip_cache_counter = Counter("synapse_replication_tcp_resource_user_ip_cache", "") user_ip_cache_counter = Counter("synapse_replication_tcp_resource_user_ip_cache", "")
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)