From a5b9c760127309d9a1f542ca04058fa852b2655e Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Wed, 18 Dec 2024 19:13:09 -0800 Subject: [PATCH] validation --- backend/ee/onyx/utils/telemetry.py | 1 + backend/onyx/document_index/vespa/shared_utils/utils.py | 4 +++- backend/onyx/utils/telemetry.py | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/ee/onyx/utils/telemetry.py b/backend/ee/onyx/utils/telemetry.py index 42ac89c61bc..d6063c29258 100644 --- a/backend/ee/onyx/utils/telemetry.py +++ b/backend/ee/onyx/utils/telemetry.py @@ -14,5 +14,6 @@ def event_telemetry( event: str, properties: dict | None = None, ) -> None: + print("event_telemetry") logger.info(f"Capturing Posthog event: {distinct_id} {event} {properties}") posthog.capture(distinct_id, event, properties) diff --git a/backend/onyx/document_index/vespa/shared_utils/utils.py b/backend/onyx/document_index/vespa/shared_utils/utils.py index da0f5c29819..d80506cba53 100644 --- a/backend/onyx/document_index/vespa/shared_utils/utils.py +++ b/backend/onyx/document_index/vespa/shared_utils/utils.py @@ -55,7 +55,9 @@ def remove_invalid_unicode_chars(text: str) -> str: return _illegal_xml_chars_RE.sub("", text) -def get_vespa_http_client(no_timeout: bool = False, http2: bool = True) -> httpx.Client: +def get_vespa_http_client( + no_timeout: bool = False, http2: bool = False +) -> httpx.Client: """ Configure and return an HTTP client for communicating with Vespa, including authentication if needed. diff --git a/backend/onyx/utils/telemetry.py b/backend/onyx/utils/telemetry.py index 23a239a5564..135f043fea6 100644 --- a/backend/onyx/utils/telemetry.py +++ b/backend/onyx/utils/telemetry.py @@ -16,12 +16,15 @@ from onyx.db.models import User from onyx.key_value_store.factory import get_kv_store from onyx.key_value_store.interface import KvKeyNotFoundError +from onyx.setup import setup_logger from onyx.utils.variable_functionality import ( fetch_versioned_implementation_with_fallback, ) from onyx.utils.variable_functionality import noop_fallback from shared_configs.configs import MULTI_TENANT +logger = setup_logger() + _DANSWER_TELEMETRY_ENDPOINT = "https://telemetry.onyx.app/anonymous_telemetry" _CACHED_UUID: str | None = None _CACHED_INSTANCE_DOMAIN: str | None = None @@ -117,9 +120,12 @@ def mt_cloud_telemetry( event: MilestoneRecordType, properties: dict | None = None, ) -> None: + logger.info(f"mt_cloud_telemetry {distinct_id} {event} {properties}") if not MULTI_TENANT: + logger.info("mt_cloud_telemetry not MULTI_TENANT") return + logger.info("mt_cloud_telemetry MULTI_TENANT") # MIT version should not need to include any Posthog code # This is only for Onyx MT Cloud, this code should also never be hit, no reason for any orgs to # be running the Multi Tenant version of Onyx. @@ -137,8 +143,11 @@ def create_milestone_and_report( properties: dict | None, db_session: Session, ) -> None: + logger.info(f"create_milestone_and_report {user} {event_type} {db_session}") _, is_new = create_milestone_if_not_exists(user, event_type, db_session) + logger.info(f"create_milestone_and_report {is_new}") if is_new: + logger.info("create_milestone_and_report is_new") mt_cloud_telemetry( distinct_id=distinct_id, event=event_type,