Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit ccb52c7

Browse files
Hash storage account when telemetry. (#568)
Signed-off-by: Pan Li <panli@microsoft.com>
1 parent 62ff4af commit ccb52c7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

azure-spring-boot/src/main/java/com/microsoft/azure/spring/autoconfigure/storage/StorageAutoConfiguration.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.security.InvalidKeyException;
2525
import java.util.HashMap;
2626

27+
import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
28+
2729
@Configuration
2830
@ConditionalOnClass(ServiceURL.class)
2931
@EnableConfigurationProperties(StorageProperties.class)
@@ -59,12 +61,12 @@ public ServiceURL createServiceUrl(@Autowired(required = false) PipelineOptions
5961

6062
return serviceURL;
6163
}
62-
64+
6365
private URL getURL() throws MalformedURLException {
6466
if (properties.isEnableHttps()) {
6567
return new URL(String.format(BLOB_HTTPS_URL, properties.getAccountName()));
6668
}
67-
return new URL(String.format(BLOB_URL, properties.getAccountName()));
69+
return new URL(String.format(BLOB_URL, properties.getAccountName()));
6870
}
6971

7072
private PipelineOptions buildOptions(PipelineOptions fromOptions) {
@@ -90,7 +92,7 @@ private void trackCustomEvent() {
9092
customTelemetryProperties.put(TelemetryData.SERVICE_NAME, packageNames[packageNames.length - 1]);
9193
}
9294

93-
customTelemetryProperties.putIfAbsent(TelemetryData.ACCOUNT_NAME, properties.getAccountName());
95+
customTelemetryProperties.putIfAbsent(TelemetryData.ACCOUNT_HASH_NAME, sha256Hex(properties.getAccountName()));
9496

9597
telemetryProxy.trackEvent(ClassUtils.getUserClass(this.getClass()).getSimpleName(), customTelemetryProperties);
9698
}

azure-spring-boot/src/main/java/com/microsoft/azure/telemetry/TelemetryData.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public class TelemetryData {
1010
public static final String INSTALLATION_ID = "installationId";
1111
public static final String PROJECT_VERSION = "version";
1212
public static final String SERVICE_NAME = "serviceName";
13-
public static final String ACCOUNT_NAME = "accountName";
13+
public static final String ACCOUNT_HASH_NAME = "accountHashName";
1414
}

0 commit comments

Comments
 (0)