fix telemetry issues

This commit is contained in:
dido committed 2026-09-24 22:46:02 +03:00
1 parent 5a285ab1a6
commit 4d64be9996
4 files changed
+19 -4

No files matched your search

-1
View File
@@ -19,7 +19,6 @@ services:
# Session Recording Configuration
- RECORDING_ENABLED=true
- RECORDING_RETENTION_DAYS=30
- STRIX_TELEMETRY_ENABLED=${STRIX_TELEMETRY_ENABLED:-true}
# Security hardening
extra_hosts:
- "host.docker.internal:host-gateway"
+2 -2
View File
@@ -122,8 +122,8 @@ logger.info(f"Session recording: enabled={RECORDING_ENABLED}, retention={RECORDI
# StrixTelemetry configuration
STRIX_TELEMETRY_ENABLED = os.environ.get("STRIX_TELEMETRY_ENABLED", "true").lower() in ("true", "1", "yes")
STRIX_TELEMETRY_URL = os.environ.get("STRIX_TELEMETRY_URL", "реалния.домейн.тук").rstrip("/")
STRIX_TELEMETRY_PRODUCT = os.environ.get("STRIX_TELEMETRY_PRODUCT", "реалния-продукт-UUID-тук")
STRIX_TELEMETRY_URL = os.environ.get("STRIX_TELEMETRY_URL", "https://telemetry.danaildr.eu").rstrip("/")
STRIX_TELEMETRY_PRODUCT = os.environ.get("STRIX_TELEMETRY_PRODUCT", "13db92bb-c88f-4d67-a0fb-c614b187104b")
STRIX_TELEMETRY_TIMEOUT = float(os.environ.get("STRIX_TELEMETRY_TIMEOUT", "10"))
STRIX_TELEMETRY_INTERVAL = int(os.environ.get("STRIX_TELEMETRY_INTERVAL", "86400"))
+9 -1
View File
@@ -2,6 +2,7 @@
import hashlib
import hmac
import json
import os
import platform
import secrets
import time
@@ -43,13 +44,20 @@ def _json_body(payload: Dict[str, Any]) -> bytes:
return json.dumps(payload, separators=(",", ":"), sort_keys=True).encode("utf-8")
def _is_docker_environment() -> bool:
return os.path.exists("/.dockerenv") or os.path.exists("/run/.dockerenv")
def _platform_data() -> Dict[str, str]:
runtime = platform.python_implementation()
if _is_docker_environment():
runtime = f"{runtime} (Docker)"
return {
"version": __version__,
"os": platform.system(),
"os_version": platform.release(),
"architecture": platform.machine(),
"runtime": platform.python_implementation(),
"runtime": runtime,
"runtime_version": platform.python_version(),
}
+8
View File
@@ -23,6 +23,14 @@ class TelemetrySigningTests(unittest.TestCase):
self.assertEqual(len(expected), 64)
self.assertEqual(expected, expected.lower())
def test_platform_data_marks_docker_runtime(self):
with patch.object(telemetry.os.path, "exists", side_effect=lambda path: path == "/.dockerenv"):
self.assertEqual(telemetry._platform_data()["runtime"], "CPython (Docker)")
def test_platform_data_keeps_python_runtime_outside_docker(self):
with patch.object(telemetry.os.path, "exists", return_value=False):
self.assertEqual(telemetry._platform_data()["runtime"], "CPython")
class FakeResponse:
status = 201