public static boolean sendEvent(TelemetryEventType type, String value, Log logger){ final Map<String, String> properties = new HashMap<String, String>(); properties.put("Description", value); try { client.trackEvent(type.getValue(), properties, null); client.flush(); Thread.sleep(1500); } catch (InterruptedException e) { logger.error(String.format("Failed sending telemetry event of type %s", type.getValue())); } return true; } }
private void sendEvent() { this.collector.getProperties().forEach((m) -> { log.info("Sending telemetry event with properties {}", m); this.client.trackEvent(collector.getName(), m, null); this.client.flush(); }); } }
private void sendEvent() { this.collector.getProperties().forEach((m) -> { log.info("Sending telemetry event with properties {}", m); this.client.trackEvent(collector.getName(), m, null); this.client.flush(); }); } }
public void trackEvent(@NonNull String eventName) { this.client.trackEvent(eventName, this.properties, null); this.client.flush(); }
public void trackEvent(@NonNull String eventName) { this.client.trackEvent(eventName, this.properties, null); this.client.flush(); }
public void trackEvent(final String eventName, final Map<String, String> customProperties, final boolean overrideDefaultProperties) { if (!isEnabled) { return; } final Map<String, String> properties = mergeProperties(getDefaultProperties(), customProperties, overrideDefaultProperties); client.trackEvent(eventName, properties, null); client.flush(); }
public void trackEvent(final String eventName, final Map<String, String> customProperties, final boolean overrideDefaultProperties) { if (!isEnabled) { return; } final Map<String, String> properties = mergeProperties(getDefaultProperties(), customProperties, overrideDefaultProperties); client.trackEvent(eventName, properties, null); client.flush(); }
public static void createFTPEvent(String eventName, String uri, String appName, String subId) { if (!isAppInsightsClientAvailable()) return; TelemetryClient telemetry = TelemetryClientSingleton.getTelemetry(); Map<String, String> properties = new HashMap<String, String>(); properties.put("SessionId", configuration.sessionId()); if (uri != null && !uri.isEmpty()) { properties.put("WebApp URI", uri); } if (appName != null && !appName.isEmpty()) { properties.put("Java app name", appName); } if (subId != null && !subId.isEmpty()) { properties.put("Subscription ID", subId); } if (configuration.validated()) { String pluginVersion = configuration.pluginVersion(); if (pluginVersion != null && !pluginVersion.isEmpty()) { properties.put("Plugin Version", pluginVersion); } String instID = configuration.installationId(); if (instID != null && !instID.isEmpty()) { properties.put("Installation ID", instID); } } synchronized(TelemetryClientSingleton.class){ telemetry.trackEvent(eventName, properties, null); telemetry.flush(); } }
public void trackEvent(final String eventName, final Map<String, String> customProperties, final boolean overrideDefaultProperties) { Map<String, String> properties = getDefaultProperties(); if (this.isAllowTelemetry) { properties = mergeProperties(getDefaultProperties(), customProperties, overrideDefaultProperties); } try { client.trackEvent(eventName, properties, null); client.flush(); } catch (Exception e) { LOGGER.trace("Failed to track event.", e); } }
public void trackEvent(final String eventName, final Map<String, String> customProperties, final boolean overrideDefaultProperties) { Map<String, String> properties = getDefaultProperties(); if (this.isAllowTelemetry) { properties = mergeProperties(getDefaultProperties(), customProperties, overrideDefaultProperties); } try { client.trackEvent(eventName, properties, null); client.flush(); } catch (Exception e) { LOGGER.trace("Failed to track event.", e); } }
public void trackEvent(@NonNull String eventName) { if (isTelemetryAllowed()) { getClient().trackEvent(eventName, getDefaultProperties(), null); getClient().flush(); } }
telemetry.flush();
@Test public void testFlush() { client.flush(); Mockito.verify(channel, Mockito.times(1)).flush(); }