Hash account name of storage when telemetry. (#567)

Signed-off-by: Pan Li <panli@microsoft.com>
This commit is contained in:
Pan Li 2019-02-13 20:31:55 -06:00 коммит произвёл GitHub
Родитель 974a59ba22
Коммит 4657ea5520
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -24,6 +24,8 @@ import java.net.URL;
import java.security.InvalidKeyException;
import java.util.HashMap;
import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
@Configuration
@ConditionalOnClass(ServiceURL.class)
@EnableConfigurationProperties(StorageProperties.class)
@ -59,12 +61,12 @@ public class StorageAutoConfiguration {
return serviceURL;
}
private URL getURL() throws MalformedURLException {
if (properties.isEnableHttps()) {
return new URL(String.format(BLOB_HTTPS_URL, properties.getAccountName()));
}
return new URL(String.format(BLOB_URL, properties.getAccountName()));
return new URL(String.format(BLOB_URL, properties.getAccountName()));
}
private PipelineOptions buildOptions(PipelineOptions fromOptions) {
@ -90,7 +92,7 @@ public class StorageAutoConfiguration {
customTelemetryProperties.put(TelemetryData.SERVICE_NAME, packageNames[packageNames.length - 1]);
}
customTelemetryProperties.putIfAbsent(TelemetryData.ACCOUNT_NAME, properties.getAccountName());
customTelemetryProperties.putIfAbsent(TelemetryData.ACCOUNT_HASH_NAME, sha256Hex(properties.getAccountName()));
telemetryProxy.trackEvent(ClassUtils.getUserClass(this.getClass()).getSimpleName(), customTelemetryProperties);
}

Просмотреть файл

@ -10,5 +10,5 @@ public class TelemetryData {
public static final String INSTALLATION_ID = "installationId";
public static final String PROJECT_VERSION = "version";
public static final String SERVICE_NAME = "serviceName";
public static final String ACCOUNT_NAME = "accountName";
public static final String ACCOUNT_HASH_NAME = "accountHashName";
}