Skip to content
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

Add heartbeat for usage collection and update to Loki 3.3 #4499

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Michaelvll
Copy link
Collaborator

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@Michaelvll Michaelvll changed the title Add heartbeat for usage collection Add heartbeat for usage collection and update to Loki 3.3 Dec 21, 2024

def __init__(self, interval_seconds: int = 600):
super().__init__(constants.USAGE_MESSAGE_SCHEMA_VERSION)
self.interval_seconds = interval_seconds
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this variable used?

EVENT_INTERVAL_SECONDS = 600

def _run(self):
usage_lib.send_heartbeat(interval_seconds=self.EVENT_INTERVAL_SECONDS)
Copy link
Collaborator

Choose a reason for hiding this comment

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

a little bit curious why we need this interval seconds argument. Doesnt skylet already has a interval mechanism..?

def run(self):
self._n = (self._n + 1) % self._event_interval
if self._n % self._event_interval == 0:
logger.debug(f'{self.__class__.__name__} triggered')
try:
self._run()
except Exception as e: # pylint: disable=broad-except
# Keep the skylet running even if an event fails.
logger.error(f'{self.__class__.__name__} error: {e}')
with ux_utils.enable_traceback():
logger.error(traceback.format_exc())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants