Skip to content

Commit ae4b29b

Browse files
LAfanasevaintellij-monorepo-bot
authored andcommitted
DO-1547 added restrictions to send statistics from TC
There are suspicious number of internal users in portraits. Presumably, they are generated by tests running on TC. Prohibit sending statistics if the client is running on TC. TC can collect statistics but not send. Allow sending from TC if the "idea.teamcity.enable.statistics" property exists. GitOrigin-RevId: 53beb21742f35a2e631fc286427ad19cc546b52b
1 parent 5c93caa commit ae4b29b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

platform/statistics/src/com/intellij/internal/statistic/utils/StatisticsUploadAssistant.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
public final class StatisticsUploadAssistant {
2323
private static final String IDEA_HEADLESS_ENABLE_STATISTICS = "idea.headless.enable.statistics";
24+
private static final String IDEA_TEAMCITY_ENABLE_STATISTICS = "idea.teamcity.enable.statistics";
2425
private static final String IDEA_SUPPRESS_REPORT_STATISTICS = "idea.suppress.statistics.report";
2526
private static final String ENABLE_LOCAL_STATISTICS_WITHOUT_REPORT = "idea.local.statistics.without.report";
2627
private static final String USE_TEST_STATISTICS_SEND_ENDPOINT = "idea.use.test.statistics.send.endpoint";
@@ -42,6 +43,12 @@ public static boolean isSendAllowed(@NotNull BooleanSupplier isAllowedByUserCons
4243
return isHeadlessStatisticsEnabled();
4344
}
4445

46+
// Prohibit sending statistics if the client is running on TC. TC can collect statistics but not send.
47+
// Allow sending from TC if the "idea.teamcity.enable.statistics" property exists.
48+
if (isTeamcityDetected()) {
49+
return isTeamcityStatisticsEnabled();
50+
}
51+
4552
return isAllowedByUserConsent.getAsBoolean();
4653
}
4754

@@ -98,6 +105,10 @@ private static boolean isHeadlessStatisticsEnabled() {
98105
return Boolean.getBoolean(IDEA_HEADLESS_ENABLE_STATISTICS);
99106
}
100107

108+
private static boolean isTeamcityStatisticsEnabled() {
109+
return Boolean.getBoolean(IDEA_TEAMCITY_ENABLE_STATISTICS);
110+
}
111+
101112
public static boolean isTestStatisticsEnabled() {
102113
return isLocalStatisticsWithoutReport()
103114
|| isTeamcityDetected()

0 commit comments

Comments
 (0)