forked from LBRYCommunity/lbry-sdk
buckets
This commit is contained in:
parent
87f751188e
commit
d3ffae72fb
2 changed files with 13 additions and 4 deletions
|
@ -290,6 +290,11 @@ class JSONRPCServerType(type):
|
|||
return klass
|
||||
|
||||
|
||||
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 Daemon(metaclass=JSONRPCServerType):
|
||||
"""
|
||||
LBRYnet daemon, a jsonrpc interface to lbry functions
|
||||
|
@ -315,7 +320,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
labelnames=("method",)
|
||||
)
|
||||
response_time_metric = Histogram(
|
||||
"response_time", "Response times", namespace="daemon_api",
|
||||
"response_time", "Response times", namespace="daemon_api", buckets=HISTOGRAM_BUCKETS,
|
||||
labelnames=("method",)
|
||||
)
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ from .util import date_to_julian_day
|
|||
log = logging.getLogger(__name__)
|
||||
sqlite3.enable_callback_tracebacks(True)
|
||||
|
||||
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')
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReaderProcessState:
|
||||
|
@ -79,10 +83,10 @@ class AIOSQLite:
|
|||
"read_count", "Number of database reads", namespace="daemon_database"
|
||||
)
|
||||
acquire_write_lock_metric = Histogram(
|
||||
f'write_lock_acquired', 'Time to acquire the write lock', namespace="daemon_database"
|
||||
f'write_lock_acquired', 'Time to acquire the write lock', namespace="daemon_database", buckets=HISTOGRAM_BUCKETS
|
||||
)
|
||||
held_write_lock_metric = Histogram(
|
||||
f'write_lock_held', 'Length of time the write lock is held for', namespace="daemon_database"
|
||||
f'write_lock_held', 'Length of time the write lock is held for', namespace="daemon_database", buckets=HISTOGRAM_BUCKETS
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
|
@ -642,7 +646,7 @@ class Database(SQLiteMixin):
|
|||
return self.db.run(__many)
|
||||
|
||||
async def reserve_outputs(self, txos, is_reserved=True):
|
||||
txoids = ((is_reserved, txo.id) for txo in txos)
|
||||
txoids = [(is_reserved, txo.id) for txo in txos]
|
||||
await self.db.executemany("UPDATE txo SET is_reserved = ? WHERE txoid = ?", txoids)
|
||||
|
||||
async def release_outputs(self, txos):
|
||||
|
|
Loading…
Reference in a new issue