Expose --index_address_statuses
setting and improve first sync performance #35
1 changed files with 7 additions and 10 deletions
|
@ -128,7 +128,7 @@ class SessionManager:
|
||||||
session_count_metric = Gauge("session_count", "Number of connected client sessions", namespace=NAMESPACE,
|
session_count_metric = Gauge("session_count", "Number of connected client sessions", namespace=NAMESPACE,
|
||||||
labelnames=("version",))
|
labelnames=("version",))
|
||||||
request_count_metric = Counter("requests_count", "Number of requests received", namespace=NAMESPACE,
|
request_count_metric = Counter("requests_count", "Number of requests received", namespace=NAMESPACE,
|
||||||
labelnames=("method", "version"))
|
labelnames=("method",))
|
||||||
tx_request_count_metric = Counter("requested_transaction", "Number of transactions requested", namespace=NAMESPACE)
|
tx_request_count_metric = Counter("requested_transaction", "Number of transactions requested", namespace=NAMESPACE)
|
||||||
tx_replied_count_metric = Counter("replied_transaction", "Number of transactions responded", namespace=NAMESPACE)
|
tx_replied_count_metric = Counter("replied_transaction", "Number of transactions responded", namespace=NAMESPACE)
|
||||||
urls_to_resolve_count_metric = Counter("urls_to_resolve", "Number of urls to resolve", namespace=NAMESPACE)
|
urls_to_resolve_count_metric = Counter("urls_to_resolve", "Number of urls to resolve", namespace=NAMESPACE)
|
||||||
|
@ -644,9 +644,9 @@ class LBRYElectrumX(asyncio.Protocol):
|
||||||
MAX_CHUNK_SIZE = 40960
|
MAX_CHUNK_SIZE = 40960
|
||||||
session_counter = itertools.count()
|
session_counter = itertools.count()
|
||||||
RESPONSE_TIMES = Histogram("response_time", "Response times", namespace=NAMESPACE,
|
RESPONSE_TIMES = Histogram("response_time", "Response times", namespace=NAMESPACE,
|
||||||
labelnames=("method", "version"), buckets=HISTOGRAM_BUCKETS)
|
labelnames=("method",), buckets=HISTOGRAM_BUCKETS)
|
||||||
NOTIFICATION_COUNT = Counter("notification", "Number of notifications sent (for subscriptions)",
|
NOTIFICATION_COUNT = Counter("notification", "Number of notifications sent (for subscriptions)",
|
||||||
namespace=NAMESPACE, labelnames=("method", "version"))
|
namespace=NAMESPACE, labelnames=("method",))
|
||||||
REQUEST_ERRORS_COUNT = Counter(
|
REQUEST_ERRORS_COUNT = Counter(
|
||||||
"request_error", "Number of requests that returned errors", namespace=NAMESPACE,
|
"request_error", "Number of requests that returned errors", namespace=NAMESPACE,
|
||||||
labelnames=("method", "version")
|
labelnames=("method", "version")
|
||||||
|
@ -793,7 +793,7 @@ class LBRYElectrumX(asyncio.Protocol):
|
||||||
"""Handle an incoming request. ElectrumX doesn't receive
|
"""Handle an incoming request. ElectrumX doesn't receive
|
||||||
notifications from client sessions.
|
notifications from client sessions.
|
||||||
"""
|
"""
|
||||||
self.session_manager.request_count_metric.labels(method=request.method, version=self.client_version).inc()
|
self.session_manager.request_count_metric.labels(method=request.method).inc()
|
||||||
|
|
||||||
if isinstance(request, Request):
|
if isinstance(request, Request):
|
||||||
method = request.method
|
method = request.method
|
||||||
|
@ -981,10 +981,7 @@ class LBRYElectrumX(asyncio.Protocol):
|
||||||
'internal server error')
|
'internal server error')
|
||||||
if isinstance(request, Request):
|
if isinstance(request, Request):
|
||||||
message = request.send_result(result)
|
message = request.send_result(result)
|
||||||
self.RESPONSE_TIMES.labels(
|
self.RESPONSE_TIMES.labels(method=request.method).observe(time.perf_counter() - start)
|
||||||
method=request.method,
|
|
||||||
version=self.client_version
|
|
||||||
).observe(time.perf_counter() - start)
|
|
||||||
if message:
|
if message:
|
||||||
await self._send_message(message)
|
await self._send_message(message)
|
||||||
if isinstance(result, Exception):
|
if isinstance(result, Exception):
|
||||||
|
@ -1014,7 +1011,7 @@ class LBRYElectrumX(asyncio.Protocol):
|
||||||
async def send_notification(self, method, args=()) -> bool:
|
async def send_notification(self, method, args=()) -> bool:
|
||||||
"""Send an RPC notification over the network."""
|
"""Send an RPC notification over the network."""
|
||||||
message = self.connection.send_notification(Notification(method, args))
|
message = self.connection.send_notification(Notification(method, args))
|
||||||
self.NOTIFICATION_COUNT.labels(method=method, version=self.client_version).inc()
|
self.NOTIFICATION_COUNT.labels(method=method).inc()
|
||||||
try:
|
try:
|
||||||
await self._send_message(message)
|
await self._send_message(message)
|
||||||
return True
|
return True
|
||||||
|
@ -1119,7 +1116,7 @@ class LBRYElectrumX(asyncio.Protocol):
|
||||||
start = time.perf_counter()
|
start = time.perf_counter()
|
||||||
self.session_manager.notifications_in_flight_metric.inc()
|
self.session_manager.notifications_in_flight_metric.inc()
|
||||||
for method, args in notifications:
|
for method, args in notifications:
|
||||||
self.NOTIFICATION_COUNT.labels(method=method, version=self.client_version).inc()
|
self.NOTIFICATION_COUNT.labels(method=method,).inc()
|
||||||
try:
|
try:
|
||||||
await self.send_notifications(
|
await self.send_notifications(
|
||||||
Batch([Notification(method, (alias, status)) for (method, (alias, status)) in notifications])
|
Batch([Notification(method, (alias, status)) for (method, (alias, status)) in notifications])
|
||||||
|
|
Loading…
Reference in a new issue