diff --git a/lbry/wallet/rpc/session.py b/lbry/wallet/rpc/session.py index dc353b50e..58d8a10fc 100644 --- a/lbry/wallet/rpc/session.py +++ b/lbry/wallet/rpc/session.py @@ -40,6 +40,10 @@ from .jsonrpc import Request, JSONRPCConnection, JSONRPCv2, JSONRPC, Batch, Noti from .jsonrpc import RPCError, ProtocolError from .framing import BadMagicError, BadChecksumError, OversizedPayloadError, BitcoinFramer, NewlineFramer +HISTOGRAM_BUCKETS = ( + .005, .01, .025, .05, .075, .1, .25, .5, .75, 1.0, 2.5, 5.0, 7.5, 10.0, 15.0, 20.0, 30.0, 60.0, float('inf') +) + class Connector: @@ -379,7 +383,7 @@ class RPCSession(SessionBase): for example JSON RPC.""" RESPONSE_TIMES = Histogram("response_time", "Response times", namespace=NAMESPACE, - labelnames=("method", "version")) + labelnames=("method", "version"), buckets=HISTOGRAM_BUCKETS) NOTIFICATION_COUNT = Counter("notification", "Number of notifications sent (for subscriptions)", namespace=NAMESPACE, labelnames=("method", "version")) REQUEST_ERRORS_COUNT = Counter( diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index cb6a32f55..69a57a2eb 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -130,6 +130,9 @@ class ChainError(Exception): NAMESPACE = "wallet_server" +HISTOGRAM_BUCKETS = ( + .005, .01, .025, .05, .075, .1, .25, .5, .75, 1.0, 2.5, 5.0, 7.5, 10.0, 15.0, 20.0, 30.0, 60.0, float('inf') +) class BlockProcessor: @@ -142,7 +145,9 @@ class BlockProcessor: block_count_metric = Gauge( "block_count", "Number of processed blocks", namespace=NAMESPACE ) - block_update_time_metric = Histogram("block_time", "Block update times", namespace=NAMESPACE) + block_update_time_metric = Histogram( + "block_time", "Block update times", namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS + ) reorg_count_metric = Gauge( "reorg_count", "Number of reorgs", namespace=NAMESPACE ) diff --git a/lbry/wallet/server/session.py b/lbry/wallet/server/session.py index 1cce96ff9..c72278992 100644 --- a/lbry/wallet/server/session.py +++ b/lbry/wallet/server/session.py @@ -119,7 +119,9 @@ class SessionGroup: NAMESPACE = "wallet_server" - +HISTOGRAM_BUCKETS = ( + .005, .01, .025, .05, .075, .1, .25, .5, .75, 1.0, 2.5, 5.0, 7.5, 10.0, 15.0, 20.0, 30.0, 60.0, float('inf') +) class SessionManager: """Holds global state about all sessions.""" @@ -147,7 +149,9 @@ class SessionManager: db_error_metric = Counter( "internal_error", "Number of queries raising unexpected errors", namespace=NAMESPACE ) - executor_time_metric = Histogram("executor_time", "SQLite executor times", namespace=NAMESPACE) + executor_time_metric = Histogram( + "executor_time", "SQLite executor times", namespace=NAMESPACE, buckets=HISTOGRAM_BUCKETS + ) pending_query_metric = Gauge( "pending_queries_count", "Number of pending and running sqlite queries", namespace=NAMESPACE ) @@ -990,7 +994,7 @@ class LBRYElectrumX(SessionBase): except reader.SQLiteInterruptedError as error: metrics = self.get_metrics_or_placeholder_for_api(query_name) metrics.query_interrupt(start, error.metrics) - self.session_mgr.self.session_mgr.SQLITE_INTERRUPT_COUNT.inc() + self.session_mgr.interrupt_count_metric.inc() raise RPCError(JSONRPC.QUERY_TIMEOUT, 'sqlite query timed out') except reader.SQLiteOperationalError as error: metrics = self.get_metrics_or_placeholder_for_api(query_name)