Skip to content

SCRAPEGRAPHAI_TELEMETRY_ENABLED=false does not disable telemetry #1118

Description

@hakoke

The README (Telemetry section) says usage collection can be disabled by setting SCRAPEGRAPHAI_TELEMETRY_ENABLED=false. Setting it has no effect, with any value.

The check in scrapegraphai/telemetry/telemetry.py (lines 47-53 on current main) only tests whether the variable exists, then reads the telemetry_enabled key from ~/.scrapegraphai.conf instead of the variable's value:

if os.environ.get("SCRAPEGRAPHAI_TELEMETRY_ENABLED") is not None:
    try:
        telemetry_enabled = config_obj.getboolean(
            "DEFAULT", "telemetry_enabled"
        )
    except Exception:
        pass

On a default install that key does not exist, so getboolean raises NoOptionError, the bare except swallows it, and the flag stays at its default of enabled. Repro:

import os, subprocess, sys

for val in ("false", "False", "FALSE", "0", "no", "off", "true"):
    out = subprocess.run(
        [sys.executable, "-c",
         "from scrapegraphai.telemetry import telemetry;"
         "print(telemetry.g_telemetry_enabled)"],
        env={**os.environ, "SCRAPEGRAPHAI_TELEMETRY_ENABLED": val},
        capture_output=True, text=True,
    )
    print(val, "->", out.stdout.strip())

prints True for every value on 2.1.6. Since log_graph_execution sends user_prompt, website_content and llm_response when those fields are all present, the documented opt-out matters. disable_telemetry() does work, but only for people who found it in the source.

Tested on 2.1.6 (current main), Python 3.12, Windows 11. I have a small fix ready and will open a PR in a few minutes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions