diff options
Diffstat (limited to 'server/sonar-server-common/src')
2 files changed, 6 insertions, 44 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigAuthMethodTelemetryProvider.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigAuthMethodTelemetryProvider.java index 4ed588eb9b5..38f3dc73e39 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigAuthMethodTelemetryProvider.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigAuthMethodTelemetryProvider.java @@ -22,41 +22,22 @@ package org.sonar.server.notification.email.telemetry; import java.util.Optional; import org.sonar.db.DbClient; import org.sonar.db.DbSession; +import org.sonar.telemetry.core.AbstractTelemetryDataProvider; import org.sonar.telemetry.core.Dimension; import org.sonar.telemetry.core.Granularity; -import org.sonar.telemetry.core.TelemetryDataProvider; import org.sonar.telemetry.core.TelemetryDataType; import static org.sonar.server.email.EmailSmtpConfiguration.EMAIL_CONFIG_SMTP_AUTH_METHOD; -public class EmailConfigAuthMethodTelemetryProvider implements TelemetryDataProvider<String> { +public class EmailConfigAuthMethodTelemetryProvider extends AbstractTelemetryDataProvider<String> { private final DbClient dbClient; public EmailConfigAuthMethodTelemetryProvider(DbClient dbClient) { + super("email_conf_auth_method", Dimension.INSTALLATION, Granularity.WEEKLY, TelemetryDataType.STRING); this.dbClient = dbClient; } @Override - public String getMetricKey() { - return "email_conf_auth_method"; - } - - @Override - public Dimension getDimension() { - return Dimension.INSTALLATION; - } - - @Override - public Granularity getGranularity() { - return Granularity.WEEKLY; - } - - @Override - public TelemetryDataType getType() { - return TelemetryDataType.STRING; - } - - @Override public Optional<String> getValue() { try (DbSession dbSession = dbClient.openSession(false)) { return Optional.of(dbClient.internalPropertiesDao().selectByKey(dbSession, EMAIL_CONFIG_SMTP_AUTH_METHOD).orElse("NOT_SET")); diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigHostTelemetryProvider.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigHostTelemetryProvider.java index e2fe55be6af..ed3a3c9ad76 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigHostTelemetryProvider.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/telemetry/EmailConfigHostTelemetryProvider.java @@ -24,41 +24,22 @@ import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.sonar.db.DbClient; import org.sonar.db.DbSession; +import org.sonar.telemetry.core.AbstractTelemetryDataProvider; import org.sonar.telemetry.core.Dimension; import org.sonar.telemetry.core.Granularity; -import org.sonar.telemetry.core.TelemetryDataProvider; import org.sonar.telemetry.core.TelemetryDataType; import static org.sonar.server.email.EmailSmtpConfiguration.EMAIL_CONFIG_SMTP_HOST; -public class EmailConfigHostTelemetryProvider implements TelemetryDataProvider<String> { +public class EmailConfigHostTelemetryProvider extends AbstractTelemetryDataProvider<String> { private final DbClient dbClient; public EmailConfigHostTelemetryProvider(DbClient dbClient) { + super("email_conf_host", Dimension.INSTALLATION, Granularity.WEEKLY, TelemetryDataType.STRING); this.dbClient = dbClient; } @Override - public String getMetricKey() { - return "email_conf_host"; - } - - @Override - public Dimension getDimension() { - return Dimension.INSTALLATION; - } - - @Override - public TelemetryDataType getType() { - return TelemetryDataType.STRING; - } - - @Override - public Granularity getGranularity() { - return Granularity.WEEKLY; - } - - @Override public Optional<String> getValue() { try (DbSession dbSession = dbClient.openSession(false)) { return Optional.of(dbClient.internalPropertiesDao() |