-
Notifications
You must be signed in to change notification settings - Fork 48
[AQUA Telemetry] Update MD Tracking #1193
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
base: main
Are you sure you want to change the base?
Changes from all commits
f6e3f00
619a925
2608622
6917c98
075d714
bc41862
5e84eaf
f3a9e9d
fc4c72a
fd09187
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 |
---|---|---|
|
@@ -37,7 +37,7 @@ def __init__( | |
description: str = "Processing", | ||
config: dict = None, | ||
signer: Signer = None, | ||
client_kwargs: dict = None, | ||
client_kwargs: dict = None, | ||
**kwargs | ||
) -> None: | ||
"""Initializes ADSWorkRequest object. | ||
|
@@ -65,6 +65,7 @@ def __init__( | |
self._description = description | ||
self._percentage = 0 | ||
self._status = None | ||
_error_message = None | ||
super().__init__(config, signer, client_kwargs, **kwargs) | ||
|
||
|
||
|
@@ -78,6 +79,7 @@ def _sync(self): | |
self._percentage= work_request.percent_complete | ||
self._status = work_request.status | ||
self._description = work_request_logs[-1].message if work_request_logs else "Processing" | ||
if work_request.status == 'FAILED' : self._error_message = self.client.list_work_request_errors | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be good to show an example output for failed and successful MD in the PR description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also let's use ruff formatter to format the code. |
||
|
||
def watch( | ||
self, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,11 @@ | |
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ | ||
|
||
|
||
import concurrent.futures | ||
import logging | ||
import threading | ||
import traceback | ||
import urllib.parse | ||
from typing import Optional | ||
import concurrent.futures | ||
|
||
import oci | ||
|
||
|
@@ -20,6 +19,7 @@ | |
THREAD_POOL_SIZE = 16 | ||
thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=THREAD_POOL_SIZE) | ||
|
||
|
||
class TelemetryClient(TelemetryBase): | ||
"""Represents a telemetry python client providing functions to record an event. | ||
|
||
|
@@ -81,7 +81,8 @@ def record_event( | |
# Here `endpoint`` is for debugging purpose | ||
# For some federated/domain users, the `endpoint` may not be a valid URL | ||
endpoint = f"{self.service_endpoint}/n/{self.namespace}/b/{self.bucket}/o/telemetry/{category}/{action}" | ||
logger.debug(f"Sending telemetry to endpoint: {endpoint}") | ||
logger.info(f"Sending telemetry to endpoint: {endpoint}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's use debug instead |
||
print(f"Sending telemetry to endpoint: {endpoint}") | ||
|
||
self.os_client.base_client.user_agent = self._encode_user_agent(**kwargs) | ||
try: | ||
|
@@ -104,7 +105,7 @@ def record_event( | |
|
||
def record_event_async( | ||
self, category: str = None, action: str = None, detail: str = None, **kwargs | ||
)-> None: | ||
) -> None: | ||
"""Send a head request to generate an event record. | ||
|
||
Parameters | ||
|
@@ -119,4 +120,4 @@ def record_event_async( | |
Thread | ||
A started thread to send a head request to generate an event record. | ||
""" | ||
thread_pool.submit(self.record_event, args=(category, action, detail), kwargs=kwargs) | ||
thread_pool.submit(self.record_event, category, action, detail, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's cleanup the print statement.