Skip to content

landingai.telemetry

This module contains the telemetry configuration and APIs for the landingai package (intented for internal use only).

get_runtime_environment_info() cached

Return a set of runtime environment information in key value pairs.

Source code in landingai/telemetry.py
@lru_cache(maxsize=None)
def get_runtime_environment_info() -> Dict[str, str]:
    """Return a set of runtime environment information in key value pairs."""
    return {
        "lib_type": "pylib",
        "lib_version": version("landingai"),
        "python_version": platform.python_version(),
        "os": platform.platform(),
        "runtime": _resolve_python_runtime(),
    }

is_running_in_pytest() cached

Return True if the code is running in a pytest session.

Source code in landingai/telemetry.py
@lru_cache(maxsize=None)
def is_running_in_pytest() -> bool:
    """Return True if the code is running in a pytest session."""
    # See: https://stackoverflow.com/questions/25188119/test-if-code-is-executed-from-within-a-py-test-session
    return "pytest" in sys.modules