Skip to content

feat: add anonymous usage telemetry for Espressif-IDE - #1494

Merged
sigmaaa merged 1 commit into
masterfrom
feat/telemetry
Aug 6, 2026
Merged

feat: add anonymous usage telemetry for Espressif-IDE#1494
sigmaaa merged 1 commit into
masterfrom
feat/telemetry

Conversation

@kolipakakondal

@kolipakakondal kolipakakondal commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Report install, update and daily session events to Azure Application Insights so we can count active users and release adoption, with installation-wide opt-out, a first-run notice and docs.

Preferences
Screenshot 2026-08-05 at 6 09 31 PM

Notification
Screenshot 2026-08-05 at 6 24 38 PM

Description

Please include a summary of the change and which issue is fixed.

Fixes # (IEP-XXX)

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this been tested?

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features

    • Added anonymous telemetry reporting for installation, updates, and session activity.
    • Added privacy settings to enable or disable telemetry.
    • Added a one-time notice explaining telemetry collection, with links to learn more or opt out.
    • Added support for English and Chinese telemetry messaging.
  • Documentation

    • Added English and Chinese documentation describing collected data, reporting frequency, and opt-out options.
  • Tests

    • Added coverage for telemetry configuration, event formatting, and session reporting intervals.

Report install, update and daily session events to Azure Application
Insights so we can count active users and release adoption, with
installation-wide opt-out, a first-run notice and docs.
@kolipakakondal kolipakakondal added this to the v4.4.0 milestone Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding anonymous usage telemetry for Espressif-IDE.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/telemetry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kolipakakondal
kolipakakondal requested a review from sigmaaa August 5, 2026 12:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java`:
- Around line 162-181: Update TelemetryPreferences.getStateNode and flush so
configuration-scope state remains the primary read/write location, but a
BackingStoreException during configuration flush retries persistence in the
InstanceScope node. Add the corresponding read fallback so values written to
InstanceScope are used when ConfigurationScope is unavailable or read-only,
preserving NOTICE_SHOWN, telemetryInstallId, telemetryLastReportedVersion, and
telemetryLastSessionReport across restarts; cover the read-only configuration
case.
- Around line 63-68: Update isDisabledByOverride() to evaluate both opt-out
sources: check the system property first, but only return true when it contains
a disabling value; otherwise continue checking TELEMETRY_ENV_VARIABLE and return
true when it is disabled. Preserve the existing blank-value fallback and
trimmed-value handling.

In `@bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/TelemetryNotice.java`:
- Line 36: Update TelemetryNotice’s documentation-link handling to select the
URL for the active locale instead of always using the English `/en/latest/`
path. Reuse the localized message/resource mechanism associated with
messages_zh.properties, and ensure the selected URL is used when opening the
browser.
- Around line 49-73: Update TelemetryNotice.showIfNeeded and open so
TelemetryPreferences.setNoticeShown is called only after NotificationPopup
successfully opens. Remove the eager state update before display.asyncExec, and
ensure the disposed-display guard in open leaves the notice unmarked so a later
session can show it.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ae99cdc4-54e3-4204-90be-019714938254

📥 Commits

Reviewing files that changed from the base of the PR and between e623b3a and 00c2b9b.

📒 Files selected for processing (25)
  • bundles/com.espressif.idf.core/META-INF/MANIFEST.MF
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/IDFCorePreferenceConstants.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryConnection.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryEnvelope.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryService.java
  • bundles/com.espressif.idf.ui/META-INF/MANIFEST.MF
  • bundles/com.espressif.idf.ui/plugin.xml
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/Messages.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/TelemetryNotice.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/TelemetryStartup.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/messages.properties
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/messages_zh.properties
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/Messages.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages.properties
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/messages_zh.properties
  • docs/en/index.rst
  • docs/en/telemetry.rst
  • docs/zh_CN/index.rst
  • docs/zh_CN/telemetry.rst
  • tests/com.espressif.idf.core.test/META-INF/MANIFEST.MF
  • tests/com.espressif.idf.core.test/src/com/espressif/idf/core/telemetry/test/TelemetryConnectionTest.java
  • tests/com.espressif.idf.core.test/src/com/espressif/idf/core/telemetry/test/TelemetryEnvelopeTest.java
  • tests/com.espressif.idf.core.test/src/com/espressif/idf/core/telemetry/test/TelemetrySessionIntervalTest.java

Comment on lines +63 to +68
String property = System.getProperty(TELEMETRY_SYSTEM_PROPERTY);
if (property == null || property.isBlank())
{
property = System.getenv(TELEMETRY_ENV_VARIABLE);
}
return property != null && isDisabledValue(property.trim());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java"
echo "== candidate file lines =="
sed -n '1,220p' "$file" | nl -ba

echo "== telemetry constants/usages =="
rg -n "TELEMETRY_SYSTEM_PROPERTY|TELEMETRY_ENV_VARIABLE|isDisabledByOverride|IDF_TELEMETRY|idf\.telemetry|Enabled\(|isEnabled\(" -S .

echo "== behavioral probe: current isDisabledByOverride logic =="
python3 - <<'PY'
def current(property_value, env_value):
    property = property_value
    if property == None or property.strip() == "":
        property = env_value
    value = property.strip() if property else None
    return value is not None and value.lower() in ("0", "false", "no")

cases = [
    ("true", "0"),
    ("", "0"),
    (None, "0"),
    ("1", "0"),
    ("0", "1"),
    ("true", None),
]
for prop, env in cases:
    print(repr(prop), repr(env), "=>", current(prop, env))
PY

Repository: espressif/idf-eclipse-plugin

Length of output: 233


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java"

echo "== candidate file lines =="
awk '{printf "%s\t%s\n", NR, $0}' "$file" | sed -n '1,220p'

echo
echo "== telemetry constants/usages =="
rg -n "TELEMETRY_SYSTEM_PROPERTY|TELEMETRY_ENV_VARIABLE|isDisabledByOverride|IDF_TELEMETRY|idf\.telemetry|Enabled\(|isEnabled\(" -S . 2>/dev/null || true

echo
echo "== behavioral probe: current isDisabledByOverride logic =="
python3 - <<'PY'
def current(property_value, env_value):
    property = property_value
    if property == None or property.strip() == "":
        property = env_value
    value = property.strip() if property else None
    return value is not None and value.lower() in ("0", "false", "no")

cases = [
    ("true", "0"),
    ("", "0"),
    (None, "0"),
    ("1", "0"),
    ("0", "1"),
    ("true", None),
]
for prop, env in cases:
    print(repr(prop), repr(env), "=>", current(prop, env))
PY

Repository: espressif/idf-eclipse-plugin

Length of output: 29806


Sensitive Data Exposure (CWE-359)

Reachability path
● Entry
  bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java:98
  addPrivacySettings
│
▼
● Sink
  bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java

Evaluate both opt-out sources.

A nonblank enabling system property currently prevents checking IDF_TELEMETRY=0, so isDisabledByOverride() returns false and telemetry can run despite the environment variable opt-out. When the system property is not disabling, continue and apply the environment-variable opt-out.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java`
around lines 63 - 68, Update isDisabledByOverride() to evaluate both opt-out
sources: check the system property first, but only return true when it contains
a disabling value; otherwise continue checking TELEMETRY_ENV_VARIABLE and return
true when it is disabled. Preserve the existing blank-value fallback and
trimmed-value handling.

Comment on lines +162 to +181
private static IEclipsePreferences getStateNode()
{
IEclipsePreferences node = ConfigurationScope.INSTANCE.getNode(IDFCorePlugin.PLUGIN_ID);
if (node == null)
{
node = InstanceScope.INSTANCE.getNode(IDFCorePlugin.PLUGIN_ID);
}
return node;
}

private static void flush(IEclipsePreferences node)
{
try
{
node.flush();
}
catch (BackingStoreException e)
{
// A read-only configuration area only means the state is recomputed on the next start
Logger.log(e, true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Locate file and relevant symbols"
if [ -f bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java ]; then
  wc -l bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java
  sed -n '1,260p' bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java
else
  echo "File not found"
  fd -i 'TelemetryPreferences.java' .
fi

echo
echo "Search telemetry persistence usages"
rg -n "TelemetryPreferences|getStateNode|flush\\(|ConfigurationScope|InstanceScope|noticeFlag|installationId|reportedVersion|sessionTimestamp" bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry -S

Repository: espressif/idf-eclipse-plugin

Length of output: 11313


Persist installation telemetry in InstanceScope when configuration scope is read-only.

getStateNode() selects ConfigurationScope whenever getNode() succeeds, and flush() only logs BackingStoreException. If that write fails, NOTICE_SHOWN, telemetryInstallId, telemetryLastReportedVersion, and telemetryLastSessionReport are not saved and can reset on restart. Add a read/read-fallback plus write fallback to InstanceScope after configuration-scope flush failure, and cover the read-only configuration area.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@bundles/com.espressif.idf.core/src/com/espressif/idf/core/telemetry/TelemetryPreferences.java`
around lines 162 - 181, Update TelemetryPreferences.getStateNode and flush so
configuration-scope state remains the primary read/write location, but a
BackingStoreException during configuration flush retries persistence in the
InstanceScope node. Add the corresponding read fallback so values written to
InstanceScope are used when ConfigurationScope is unavailable or read-only,
preserving NOTICE_SHOWN, telemetryInstallId, telemetryLastReportedVersion, and
telemetryLastSessionReport across restarts; cover the read-only configuration
case.

{
private static final String LEARN_MORE_HREF = "learnMore"; //$NON-NLS-1$
private static final String DISABLE_HREF = "disable"; //$NON-NLS-1$
private static final String DOCUMENTATION_URL = "https://docs.espressif.com/projects/espressif-ide/en/latest/telemetry.html"; //$NON-NLS-1$

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Select the documentation URL from the active locale.

The Chinese notice uses messages_zh.properties, but DOCUMENTATION_URL always opens /en/latest/. Select the localized documentation URL before opening the browser.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/TelemetryNotice.java`
at line 36, Update TelemetryNotice’s documentation-link handling to select the
URL for the active locale instead of always using the English `/en/latest/`
path. Reuse the localized message/resource mechanism associated with
messages_zh.properties, and ensure the selected URL is used when opening the
browser.

Comment on lines +49 to +73
public static void showIfNeeded()
{
if (TelemetryPreferences.isNoticeShown() || !TelemetryService.getInstance().isEnabled()
|| !PlatformUI.isWorkbenchRunning())
{
return;
}

Display display = PlatformUI.getWorkbench().getDisplay();
if (display.isDisposed())
{
return;
}
TelemetryPreferences.setNoticeShown();
display.asyncExec(() -> open(display));
}

private static void open(Display display)
{
if (display.isDisposed())
{
return;
}
NotificationPopup.forDisplay(display).title(Messages.TelemetryNotice_Title, true)
.content(TelemetryNotice::createContent).delay(CLOSE_DELAY_MS).open();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Persist the notice state after the popup opens.

Line 62 marks the notice as shown before the queued UI task runs. If the display is disposed before open(display), Lines 68-71 return and later sessions never show the notice. Set the state only after the popup opens successfully.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/TelemetryNotice.java`
around lines 49 - 73, Update TelemetryNotice.showIfNeeded and open so
TelemetryPreferences.setNoticeShown is called only after NotificationPopup
successfully opens. Remove the eager state update before display.asyncExec, and
ensure the disposed-display guard in open leaves the notice unmarked so a later
session can show it.

@sigmaaa sigmaaa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sigmaaa
sigmaaa merged commit c303213 into master Aug 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants