-
Notifications
You must be signed in to change notification settings - Fork 676
Initial prototype of telemetry hook #7443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import logging | ||
| from modin.utils import timeout | ||
|
|
||
| _telemetry_handlers = [] | ||
|
|
||
| # Telemetry hooks can be implemented by plugin engines | ||
| # to collect discrete data on how modin is performing at the | ||
| # high level moden layer. | ||
| def emit_telemetry_event(msg:str, value:int|float): | ||
| _telemetry_handlers | ||
Check noticeCode scanning / CodeQL Statement has no effect Note
This statement has no effect.
|
||
| handlers = _telemetry_handlers.copy() | ||
| for fn in handlers: | ||
| try: | ||
| with timeout(seconds=1): | ||
| fn(f"modin::{msg}", value) | ||
| except: | ||
Check noticeCode scanning / CodeQL Except block handles 'BaseException' Note
Except block directly handles BaseException.
|
||
| logging.ERROR("telemetry handler threw exception, removing handler: " + e) | ||
| _telemetry_handlers.remove(fn) | ||
| pass | ||
Check warningCode scanning / CodeQL Unnecessary pass Warning
Unnecessary 'pass' statement.
|
||
|
|
||
| def add_telemetry_handler(handler:callable): | ||
| _telemetry_handlers.append(handler) | ||
|
|
||
| def clear_telemetry_handler(handler): | ||
| _telemetry_handlers = [] | ||
Check noticeCode scanning / CodeQL Unused local variable Note
Variable _telemetry_handlers is not used.
|
||
|
|
||
|
|
||
Check failure
Code scanning / CodeQL
Explicit export is not defined Error