|
24 | 24 | import uuid |
25 | 25 | import locale |
26 | 26 | from abc import ABC, abstractmethod |
| 27 | +from databricks.sql import __version__ |
27 | 28 |
|
28 | 29 |
|
29 | 30 | class TelemetryHelper: |
30 | 31 | """Helper class for getting telemetry related information.""" |
31 | 32 |
|
32 | | - _DRIVER_SYSTEM_CONFIGURATION = None |
| 33 | + _DRIVER_SYSTEM_CONFIGURATION = DriverSystemConfiguration( |
| 34 | + driver_name="Databricks SQL Python Connector", |
| 35 | + driver_version=__version__, |
| 36 | + runtime_name=f"Python {sys.version.split()[0]}", |
| 37 | + runtime_vendor=platform.python_implementation(), |
| 38 | + runtime_version=platform.python_version(), |
| 39 | + os_name=platform.system(), |
| 40 | + os_version=platform.release(), |
| 41 | + os_arch=platform.machine(), |
| 42 | + client_app_name=None, # TODO: Add client app name |
| 43 | + locale_name=locale.getlocale()[0] or locale.getdefaultlocale()[0], |
| 44 | + char_set_encoding=sys.getdefaultencoding(), |
| 45 | + ) |
33 | 46 |
|
34 | 47 | @classmethod |
35 | 48 | def getDriverSystemConfiguration(cls) -> DriverSystemConfiguration: |
36 | | - """Get the driver system configuration.""" |
37 | | - if cls._DRIVER_SYSTEM_CONFIGURATION is None: |
38 | | - from databricks.sql import __version__ |
39 | | - |
40 | | - cls._DRIVER_SYSTEM_CONFIGURATION = DriverSystemConfiguration( |
41 | | - driver_name="Databricks SQL Python Connector", |
42 | | - driver_version=__version__, |
43 | | - runtime_name=f"Python {sys.version.split()[0]}", |
44 | | - runtime_vendor=platform.python_implementation(), |
45 | | - runtime_version=platform.python_version(), |
46 | | - os_name=platform.system(), |
47 | | - os_version=platform.release(), |
48 | | - os_arch=platform.machine(), |
49 | | - client_app_name=None, # TODO: Add client app name |
50 | | - locale_name=locale.getlocale()[0] or locale.getdefaultlocale()[0], |
51 | | - char_set_encoding=sys.getdefaultencoding(), |
52 | | - ) |
53 | 49 | return cls._DRIVER_SYSTEM_CONFIGURATION |
54 | 50 |
|
55 | 51 | @staticmethod |
|
0 commit comments