Skip to content

Commit

Permalink
chore(engine): disable telemetry by default (#4208)
Browse files Browse the repository at this point in the history
* set false as default value for initializeTelemetry and switch to primitive
* engine tests: test default value
* LoginIT: remove telemetry close modal
* initializeTelemetryProperty: add null check

related to #4167
  • Loading branch information
yanavasileva authored Mar 25, 2024
1 parent 7d3b21f commit 9b6f612
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pipeline {
[envVar: 'XLTS_AUTH_TOKEN', vaultKey: 'authToken']]
]]]) {
cambpmRunMaven('.',
'clean source:jar deploy source:test-jar com.mycila:license-maven-plugin:check -Pdistro,distro-ce,distro-wildfly,distro-webjar,h2-in-memory -DaltStagingDirectory=${WORKSPACE}/staging -DskipRemoteStaging=true',
'clean source:jar deploy source:test-jar com.mycila:license-maven-plugin:check -Pdistro,distro-ce,distro-wildfly,distro-webjar,h2-in-memory -DaltStagingDirectory=${WORKSPACE}/staging -DskipRemoteStaging=true ',
withCatch: false,
withNpm: true,
// we use JDK 17 to build the artifacts, as it is required for supporting Spring Boot 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ public void login(String appName) {

wait.until(visibilityOfElementLocated(By.cssSelector("button[type=\"submit\"]")))
.submit();

wait.until(visibilityOfElementLocated(By.cssSelector(".modal-close")))
.click();
}

public void sendKeys(WebElement element, String keys) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void initializeTelemetryProperty(CommandContext commandContext) {

// reset collected dynamic data
if ((databaseTelemetryProperty == null && processEngineConfiguration.isInitializeTelemetry())
|| Boolean.parseBoolean(databaseTelemetryProperty.getValue())) {
|| (databaseTelemetryProperty != null && Boolean.parseBoolean(databaseTelemetryProperty.getValue()))) {
TelemetryUtil.toggleLocalTelemetry(true,
processEngineConfiguration.getTelemetryRegistry(),
processEngineConfiguration.getMetricsRegistry());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,9 @@ public abstract class ProcessEngineConfigurationImpl extends ProcessEngineConfig
* when it has never been enabled/disabled before.
* Subsequent changes can be done only via the
* {@link ManagementService#toggleTelemetry(boolean) Telemetry} API in {@link ManagementService}
* Telemetry is deactivated by default.
*/
protected Boolean initializeTelemetry = null;
protected boolean initializeTelemetry = false;
/** The endpoint which telemetry is sent to */
protected String telemetryEndpoint = "https://api.telemetry.camunda.cloud/pings";
/** The number of times the telemetry request is retried in case it fails **/
Expand Down Expand Up @@ -5333,7 +5334,7 @@ public ProcessEngineConfigurationImpl setDmnReturnBlankTableOutputAsNull(boolean
return this;
}

public Boolean isInitializeTelemetry() {
public boolean isInitializeTelemetry() {
return initializeTelemetry;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ public void shouldStartEngineWithTelemetryDefaults() {
inMemoryConfiguration.buildProcessEngine();

// then
assertThat(inMemoryConfiguration.isInitializeTelemetry()).isNull();
assertThat(inMemoryConfiguration.getManagementService().isTelemetryEnabled()).isNull();
assertThat(inMemoryConfiguration.isInitializeTelemetry()).isFalse();
assertThat(inMemoryConfiguration.getManagementService().isTelemetryEnabled()).isFalse();

// the telemetry reporter is always scheduled
assertThat(inMemoryConfiguration.isTelemetryReporterActivate()).isTrue();
assertThat(inMemoryConfiguration.getTelemetryReporter().isScheduled()).isTrue();
assertThat(inMemoryConfiguration.getTelemetryReporter().getInitialReportingDelaySeconds()).isEqualTo(TelemetryReporter.EXTENDED_INIT_REPORT_DELAY_SECONDS);
assertThat(inMemoryConfiguration.getTelemetryReporter().getInitialReportingDelaySeconds()).isEqualTo(TelemetryReporter.DEFAULT_INIT_REPORT_DELAY_SECONDS);
}

@Test
Expand Down Expand Up @@ -169,7 +169,7 @@ public void shouldStartEngineWithTelemetryEnabledAndLicenseKeyAlreadyPresent() {

@Test
@WatchLogger(loggerNames = {"org.camunda.bpm.engine.persistence"}, level = "DEBUG")
public void shouldLogDefaultTelemetryValue() {
public void shouldNotLogDefaultTelemetryValue() {
// given
Boolean telemetryInitializedValue = null;
inMemoryConfiguration = new StandaloneInMemProcessEngineConfiguration();
Expand All @@ -180,7 +180,24 @@ public void shouldLogDefaultTelemetryValue() {
inMemoryConfiguration.buildProcessEngine();

// then
assertThat(loggingRule.getFilteredLog("Creating the telemetry property in database with the value: " + telemetryInitializedValue).size()).isOne();
assertThat(loggingRule.getFilteredLog("Creating the telemetry property in database with the value: " + telemetryInitializedValue).size()).isZero();
}

@Test
@WatchLogger(loggerNames = {"org.camunda.bpm.engine.persistence"}, level = "DEBUG")
public void shouldLogTelemetryValue() {
// given
Boolean telemetryInitializedValue = null;
inMemoryConfiguration = new StandaloneInMemProcessEngineConfiguration();
inMemoryConfiguration
.setJdbcUrl("jdbc:h2:mem:camunda" + getClass().getSimpleName())
.setInitializeTelemetry(true);

// when
inMemoryConfiguration.buildProcessEngine();

// then
assertThat(loggingRule.getFilteredLog("Creating the telemetry property in database with the value: " + telemetryInitializedValue).size()).isZero();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static org.assertj.core.api.Assertions.assertThat;

import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.test.TestHelper;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.engine.test.util.ProcessEngineBootstrapRule;
import org.camunda.bpm.engine.test.util.ProvidedProcessEngineRule;
Expand Down Expand Up @@ -48,16 +47,15 @@ public class TelemetryDefaultConfigTest {
@Before
public void setup() {
configuration = engineRule.getProcessEngineConfiguration();
TestHelper.deleteTelemetryProperty(configuration);
}

@Test
public void shouldHaveEmptyInitilizeTelemetryByDefault() {
// given default configuration

// then
assertThat(configuration.isInitializeTelemetry()).isNull();
assertThat(configuration.getManagementService().isTelemetryEnabled()).isNull();
assertThat(configuration.isInitializeTelemetry()).isFalse();
assertThat(configuration.getManagementService().isTelemetryEnabled()).isFalse();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public void login(String appName) {
wait.until(visibilityOfElementLocated(By.cssSelector("button[type=\"submit\"]")))
.submit();

wait.until(visibilityOfElementLocated(By.cssSelector(".modal-close")))
.click();
}

public void sendKeys(WebElement element, String keys) {
Expand Down

0 comments on commit 9b6f612

Please sign in to comment.