Skip to content

Make telemetry directory configurable and add environment variable to disable telemetry #73

@adonig

Description

@adonig

Problem

The telemetry library creates a non-hidden directory in the user's home folder (~/intel on Linux/macOS, %LOCALAPPDATA%/Intel Corporation on Windows) that cannot be configured or relocated. This creates visual clutter in home directories and doesn't follow common practices for application data storage on Unix-like systems.

Current behavior:

  • Telemetry files are always stored in ~/intel/ on Linux/macOS (hardcoded in src/utils/opt_in_checker.py:120)
  • Users cannot change this location via environment variable or configuration
  • The folder is not hidden (no . prefix on Unix systems)
  • To disable telemetry, users must either:
    1. Run the opt_in_out --opt_out script (if they have it installed)
    2. Manually create ~/intel/openvino_telemetry with content "0"

Expected behavior:
Users should have better control over where telemetry data is stored and how to disable it.

Impact

This affects users who:

  • Use OpenVINO indirectly through other packages (e.g., sentence-transformers with OpenVINO backend)
  • Want to keep their home directory clean
  • Prefer XDG Base Directory specification compliance
  • Want to disable telemetry without creating folders

Proposed Solutions

Option 1: Environment variable to disable telemetry

Add support for OPENVINO_TELEMETRY_OPTOUT=1 environment variable:

@staticmethod
def _run_in_ci():
    """Check if telemetry should be disabled"""
    # Add this check
    if os.environ.get("OPENVINO_TELEMETRY_OPTOUT", "").lower() in ("1", "true", "yes"):
        return True

    # Existing CI checks
    if "CI" in os.environ and os.environ["CI"].lower() == "true":
        return True
    # ... rest of existing checks

This would allow users to disable telemetry with:

export OPENVINO_TELEMETRY_OPTOUT=1

Option 2: Make directory configurable

Add environment variable support for custom directory location:

@staticmethod
def consent_file_subdirectory():
    """Returns consent file subdirectory."""
    # Allow override via environment variable
    custom_dir = os.environ.get("OPENVINO_TELEMETRY_DIR")
    if custom_dir:
        return custom_dir

    platform = system()
    if platform == 'Windows':
        return 'Intel Corporation'
    elif platform in ['Linux', 'Darwin']:
        return 'intel'  # Consider changing to '.intel' for hidden folder
    log.info('Failed to find location of the openvino_telemetry file.')
    return None

This would allow:

# Use hidden folder
export OPENVINO_TELEMETRY_DIR=.intel

# Or use XDG standard
export OPENVINO_TELEMETRY_DIR=.local/share/openvino

Option 3: Follow XDG Base Directory specification (Best for Linux/macOS)

On Linux/macOS, respect XDG_DATA_HOME (typically ~/.local/share):

elif platform in ['Linux', 'Darwin']:
    xdg_data = os.environ.get('XDG_DATA_HOME', os.path.join(Path.home(), '.local', 'share'))
    return os.path.join(xdg_data, 'openvino')

Files Affected

All three telemetry files use the same directory method:

  • openvino_telemetry (consent file) - opt_in_checker.py:129
  • openvino_ga_cid (client ID) - cid.py:63-69
  • stats (usage statistics) - stats_processor.py:31-35

Minimal Breaking Change Suggestion

  1. Add OPENVINO_TELEMETRY_OPTOUT environment variable support (no breaking changes)
  2. Change intel to .intel on Linux/macOS for new installations (minor breaking change, but cleaner)
  3. Support migration from old ~/intel to new ~/.intel automatically

References

Use Case

Users who install packages like sentence-transformers with OpenVINO backend should be able to:

  1. Easily disable telemetry without manual file creation
  2. Not have unexpected folders appear in their home directory
  3. Choose where telemetry data is stored if they do opt-in

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions