Skip to content

Commit

Permalink
fix: remove decr stats logging events (pinterest#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
jczhong84 authored and aidenprice committed Jan 3, 2024
1 parent 7d32270 commit 083eb0b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "querybook",
"version": "3.23.1",
"version": "3.23.2",
"description": "A Big Data Webapp",
"private": true,
"scripts": {
Expand Down
18 changes: 13 additions & 5 deletions querybook/server/datasources_socketio/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ def handler(*args, **kwargs):
if not current_user.is_authenticated:
LOG.error("Unauthorized websocket access")
disconnect()
# decrement ws connections counter on disconnect
stats_logger.decr(WS_CONNECTIONS)
# incr ws connections counter on disconnect
stats_logger.incr(
WS_CONNECTIONS, tags={"namespace": namespace, "event": "disconnect"}
)
else:
try:
if websocket_logging:
Expand All @@ -41,10 +43,16 @@ def handler(*args, **kwargs):

# increment ws connections counter on connect
if url == "connect":
stats_logger.incr(WS_CONNECTIONS, tags={"namespace": namespace})
# decrement ws connections counter on disconnect
stats_logger.incr(
WS_CONNECTIONS,
tags={"namespace": namespace, "event": "connect"},
)
# incr ws connections counter on disconnect
elif url == "disconnect":
stats_logger.decr(WS_CONNECTIONS, tags={"namespace": namespace})
stats_logger.incr(
WS_CONNECTIONS,
tags={"namespace": namespace, "event": "disconnect"},
)

handler.__raw__ = fn
return handler
Expand Down
2 changes: 0 additions & 2 deletions querybook/server/tasks/run_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ def run_query_task(
7406, "{}\n{}".format(e, traceback.format_exc())
)
finally:
stats_logger.decr(QUERY_EXECUTIONS, tags={"execution_type": execution_type})

# When the finally block is reached, it is expected
# that the executor should be in one of the end state
with DBSession() as session:
Expand Down

0 comments on commit 083eb0b

Please sign in to comment.