Skip to content

Commit

Permalink
validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Dec 19, 2024
1 parent e9b10e8 commit a5b9c76
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/ee/onyx/utils/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 3 additions & 1 deletion backend/onyx/document_index/vespa/shared_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions backend/onyx/utils/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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,
Expand Down

0 comments on commit a5b9c76

Please sign in to comment.