Search in sources :

Example 1 with AzureTelemetryClient

use of com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient in project azure-maven-plugins by microsoft.

the class AbstractAzureMojo method initTelemetryProxy.

protected void initTelemetryProxy() {
    final Map<String, String> properties = getTelemetryProperties();
    telemetryProxy = new AzureTelemetryClient(properties);
    AzureTelemeter.setClient(telemetryProxy);
    AzureTelemeter.setEventNamePrefix("AzurePlugin.Maven");
    if (!isAllowTelemetry()) {
        telemetryProxy.trackEvent(TELEMETRY_NOT_ALLOWED);
        telemetryProxy.disable();
    }
}
Also used : AzureTelemetryClient(com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient)

Example 2 with AzureTelemetryClient

use of com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient in project azure-tools-for-java by microsoft.

the class AppInsightsClient method create.

private static void create(String eventName, String version, @Nullable Map<String, String> myProperties, Map<String, Double> metrics, boolean force) {
    if (isAppInsightsClientAvailable() && configuration.validated()) {
        String prefValue = configuration.preferenceVal();
        if (prefValue == null || prefValue.isEmpty() || prefValue.equalsIgnoreCase("true") || force) {
            AzureTelemetryClient telemetry = TelemetryClientSingleton.getTelemetry();
            Map<String, String> properties = buildProperties(version, myProperties);
            synchronized (TelemetryClientSingleton.class) {
                telemetry.trackEvent(eventName, properties, metrics);
            }
        }
    }
}
Also used : AzureTelemetryClient(com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient)

Example 3 with AzureTelemetryClient

use of com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient in project azure-tools-for-java by Microsoft.

the class AppInsightsClient method create.

private static void create(String eventName, String version, @Nullable Map<String, String> myProperties, Map<String, Double> metrics, boolean force) {
    if (isAppInsightsClientAvailable() && configuration.validated()) {
        String prefValue = configuration.preferenceVal();
        if (prefValue == null || prefValue.isEmpty() || prefValue.equalsIgnoreCase("true") || force) {
            AzureTelemetryClient telemetry = TelemetryClientSingleton.getTelemetry();
            Map<String, String> properties = buildProperties(version, myProperties);
            synchronized (TelemetryClientSingleton.class) {
                telemetry.trackEvent(eventName, properties, metrics);
            }
        }
    }
}
Also used : AzureTelemetryClient(com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient)

Example 4 with AzureTelemetryClient

use of com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient in project azure-tools-for-java by Microsoft.

the class AppInsightsClient method initTelemetryManager.

private static void initTelemetryManager() {
    try {
        final Map<String, String> properties = buildProperties("", new HashMap<>());
        TelemetryClientSingleton.setConfiguration(configuration);
        final AzureTelemetryClient client = TelemetryClientSingleton.getTelemetry();
        final String eventNamePrefix = configuration.eventName();
        TelemetryManager.getInstance().setTelemetryClient(client);
        TelemetryManager.getInstance().setCommonProperties(properties);
        TelemetryManager.getInstance().setEventNamePrefix(eventNamePrefix);
        TelemetryManager.getInstance().sendCachedTelemetries();
        AzureTelemeter.setClient(client);
        AzureTelemeter.setCommonProperties(properties);
        AzureTelemeter.setEventNamePrefix(eventNamePrefix);
    } catch (Exception ignore) {
    }
}
Also used : AzureTelemetryClient(com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient)

Example 5 with AzureTelemetryClient

use of com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient in project azure-tools-for-java by microsoft.

the class AppInsightsClient method initTelemetryManager.

private static void initTelemetryManager() {
    try {
        final Map<String, String> properties = buildProperties("", new HashMap<>());
        TelemetryClientSingleton.setConfiguration(configuration);
        final AzureTelemetryClient client = TelemetryClientSingleton.getTelemetry();
        final String eventNamePrefix = configuration.eventName();
        TelemetryManager.getInstance().setTelemetryClient(client);
        TelemetryManager.getInstance().setCommonProperties(properties);
        TelemetryManager.getInstance().setEventNamePrefix(eventNamePrefix);
        TelemetryManager.getInstance().sendCachedTelemetries();
        AzureTelemeter.setClient(client);
        AzureTelemeter.setCommonProperties(properties);
        AzureTelemeter.setEventNamePrefix(eventNamePrefix);
    } catch (Exception ignore) {
    }
}
Also used : AzureTelemetryClient(com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient)

Aggregations

AzureTelemetryClient (com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient)6