-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update some stats metrics names and add tags (#1208)
- Loading branch information
Showing
12 changed files
with
67 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
from flask_login import current_user | ||
from flask_socketio import ConnectionRefusedError | ||
|
||
from app.flask_app import socketio | ||
from const.data_doc import DATA_DOC_NAMESPACE | ||
from const.query_execution import QUERY_EXECUTION_NAMESPACE | ||
from lib.stats_logger import stats_logger, WS_CONNECTIONS_COUNTER | ||
|
||
from .helper import register_socket | ||
|
||
def connect(): | ||
stats_logger.incr(WS_CONNECTIONS_COUNTER) | ||
|
||
def on_connect(): | ||
if not current_user.is_authenticated: | ||
raise ConnectionRefusedError("User is not logged in, please refresh the page.") | ||
|
||
|
||
socketio.on_event("connect", connect, namespace=DATA_DOC_NAMESPACE) | ||
socketio.on_event("connect", connect, namespace=QUERY_EXECUTION_NAMESPACE) | ||
@register_socket("connect", namespace=QUERY_EXECUTION_NAMESPACE) | ||
def connect_query_execution(auth): | ||
on_connect() | ||
|
||
|
||
@register_socket("connect", namespace=DATA_DOC_NAMESPACE) | ||
def connect_datadoc(auth): | ||
on_connect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
from env import QuerybookSettings | ||
from lib.stats_logger.all_stats_loggers import get_stats_logger_class | ||
from .base_stats_logger import BaseStatsLogger | ||
|
||
|
||
# metrics name templates | ||
API_REQUEST_COUNTER = "api.{}" | ||
API_REQUEST_LATENCY_TIMER = "api.duration.ms.{}" | ||
WS_CONNECTIONS_COUNTER = "ws.connections" | ||
SQL_SESSION_FAILURE_COUNTER = "sql.session.failure" | ||
SYSTEM_TASK_FAILURE_COUNTER = "task.failure.system" | ||
DATADOC_TASK_FAILURE_COUNTER = "task.failure.datadoc" | ||
REDIS_LATENCY_TIMER = "redis.duration.ms.{}" | ||
QUERY_EXECUTION_COUNTER = "query_execution.{}" | ||
# metrics name | ||
API_REQUESTS = "api.requests" | ||
WS_CONNECTIONS = "ws.connections" | ||
SQL_SESSION_FAILURES = "sql_session.failures" | ||
TASK_FAILURES = "task.failures" | ||
REDIS_OPERATIONS = "redis.operations" | ||
QUERY_EXECUTIONS = "query.executions" | ||
|
||
|
||
logger_name = QuerybookSettings.STATS_LOGGER_NAME | ||
stats_logger: BaseStatsLogger = get_stats_logger_class(logger_name) | ||
stats_logger = get_stats_logger_class(logger_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters