def enable_telemetry()

in telemetry/telemetry.py [0:0]


def enable_telemetry(client, notebook_name=None):
    """Enable telemetry for the given elasticsearch client instance."""
    if "nbtest" in os.environ.get("_", ""):
        # no telemetry for tests
        return client

    platform = get_notebook_platform()
    if notebook_name is None:
        notebook_name = get_notebook_name()

    client = client.options(
        headers={"user-agent": f"{SEARCHLABS_USER_AGENT}/{notebook_name} ({platform})"}
    )
    print(f'Telemetry enabled for "{notebook_name}". Thank you!')
    return client