Skip to content

ODSC-70796 instead of threads for each telemetry event, created a glo… #1166

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

agrimk
Copy link
Member

@agrimk agrimk commented Apr 24, 2025

instead of threads for each telemetry event, created a global thread pool

Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Apr 24, 2025
@@ -23,7 +25,8 @@
USER_AGENT_KEY = "additional_user_agent"
UNKNOWN = "UNKNOWN"
DELIMITER = "&"

THREAD_POOL_SIZE = 16
thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=THREAD_POOL_SIZE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The telemetry.py and client.py modules handle different aspects of telemetry. I suggest moving the thread pool creation to client.py.

thread_pool.shutdown(wait=True)
web_app.log.info("Telemetry threadpool shutdown completed.")

web_app.io_loop.add_callback(run_on_shutdown)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this logic. Technically user can use AQUA CLI where we capture the telemetry as well. Users don't need to run extension in this case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that I should call the shutdown there as well ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I men, do we really need to shut it down? In which case it would be useful?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it. I am removing the shutdown code in that case.
I added it since it was part of the ticket ODSC-70796

thread.start()
return thread
thread_pool.submit(self.record_event, args=(category, action, detail), kwargs=kwargs)
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't need to return anything form this method, however it would be nice to add return typing:

def record_event_async(
        self, category: str = None, action: str = None, detail: str = None, **kwargs
    ) -> None:

@@ -37,6 +37,12 @@ def load_jupyter_server_extension(nb_server_app):
[(url_path_join(route_pattern, url), handler) for url, handler in __handlers__],
)

def run_on_shutdown():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this? ADS can be used without the running the Jlab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants