Search in sources :

Example 1 with AppInsightsHttpRequestInstallIdMapRecord

use of com.microsoft.azure.hdinsight.common.appinsight.AppInsightsHttpRequestInstallIdMapRecord in project azure-tools-for-java by Microsoft.

the class SparkBatchSubmission method getUserAgentPerRequest.

/**
 * To generator a User-Agent for HTTP request with a random UUID
 *
 * @param isMapToInstallID true for create the relationship between the UUID and InstallationID
 * @return the unique UA string
 */
@NotNull
private String getUserAgentPerRequest(boolean isMapToInstallID) {
    String loadingClass = SparkBatchSubmission.class.getClassLoader().getClass().getName().toLowerCase();
    String userAgentSource = loadingClass.contains("intellij") ? "Azure Toolkit for IntelliJ " : (loadingClass.contains("eclipse") ? "Azure Toolkit for Eclipse " : "Azure HDInsight Java SDK ");
    String requestId = AppInsightsClient.getConfigurationSessionId() == null ? UUID.randomUUID().toString() : AppInsightsClient.getConfigurationSessionId();
    if (isMapToInstallID) {
        new AppInsightsHttpRequestInstallIdMapRecord(requestId, getInstallationID()).post();
    }
    return userAgentSource + requestId;
}
Also used : AppInsightsHttpRequestInstallIdMapRecord(com.microsoft.azure.hdinsight.common.appinsight.AppInsightsHttpRequestInstallIdMapRecord) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull)

Aggregations

AppInsightsHttpRequestInstallIdMapRecord (com.microsoft.azure.hdinsight.common.appinsight.AppInsightsHttpRequestInstallIdMapRecord)1 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)1