Skip to content

Commit 4dca8a9

Browse files
committed
Skip invalid metrics for StaticPool
1 parent 9d36d5a commit 4dca8a9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tiled/server/metrics.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from prometheus_client import Counter, Gauge, Histogram
88
from sqlalchemy import event
9-
from sqlalchemy.pool import QueuePool
9+
from sqlalchemy.pool import QueuePool, StaticPool
1010

1111
REQUEST_DURATION = Histogram(
1212
"tiled_request_duration_seconds",
@@ -220,6 +220,10 @@ def on_checkout(dbapi_connection, connection_record, connection_proxy):
220220
DB_POOL_CHECKEDOUT.labels(name).inc()
221221
DB_POOL_CHECKOUTS_TOTAL.labels(name).inc()
222222

223+
# Skip for single-connection database:
224+
if isinstance(pool, StaticPool):
225+
return
226+
223227
# First overflow: we just used the very first overflow slot
224228
if pool.overflow() == 1:
225229
DB_POOL_FIRST_OVERFLOW_TOTAL.labels(name).inc()

0 commit comments

Comments
 (0)