change sessionid to uuid-like format (#4476)

This commit is contained in:
Henrique Joaquim
2023-03-14 17:23:17 +00:00
committed by GitHub
parent 5a69fba516
commit 1cdee7da70

View File

@@ -5,6 +5,7 @@ __docformat__ = "numpy"
import logging
import sys
import time
import uuid
from pathlib import Path
from typing import Optional
@@ -47,8 +48,6 @@ logging.getLogger("urllib3").setLevel(LOGGING_VERBOSITY)
logger = logging.getLogger(__name__)
START_TIMESTAMP = int(time.time())
def get_app_id() -> str:
"""UUID of the current installation."""
@@ -69,6 +68,12 @@ def get_app_id() -> str:
return app_id
def get_session_id() -> str:
"""UUID of the current session."""
session_id = str(uuid.uuid4()) + "-" + str(int(time.time()))
return session_id
def get_commit_hash(use_env=True) -> str:
"""Get Commit Short Hash"""
@@ -157,7 +162,6 @@ def setup_handlers(settings: Settings):
def setup_logging(
app_name: Optional[str] = None,
frequency: Optional[str] = None,
session_id: Optional[str] = None,
verbosity: Optional[int] = None,
) -> None:
"""Setup Logging"""
@@ -166,7 +170,7 @@ def setup_logging(
commit_hash = get_commit_hash()
name = app_name or LOGGING_APP_NAME
identifier = get_app_id()
session_id = session_id or str(START_TIMESTAMP)
session_id = get_session_id()
user_id = get_user_uuid()
# AWSSettings