/** * Constructs new telemetry client proxy instance. * @param instrumentationKey The instrumentation key for sending the events. */ public LogTelemetryClientProxy(String instrumentationKey) { this(new TelemetryClient(), instrumentationKey); }
@Override public void run() { tclient.trackEvent(name, properties, metrics); } };
/** * Sends a TraceTelemetry record to Application Insights. Appears in "traces" in Analytics and Search. * @param message A log message. Max length 10000. */ public void trackTrace(String message) { trackTrace(message, null, null); }
@Test public void testTrackEventWithName() { client.trackEvent("Event"); verifyAndGetLastEventSent(); }
/** * Send information about the page viewed in the application. * @param telemetry The telemetry to send */ public void trackPageView(PageViewTelemetry telemetry) { track(telemetry); }
/** * Initializes a new instance of the TelemetryClient class, configured from the active configuration. */ public TelemetryClient() { this(TelemetryConfiguration.getActive()); }
@Test public void testTrackExceptionWithPropertiesAndMetrics() { Exception exception = new Exception("Exception"); Map<String, String> properties = new HashMap<String, String>() {{ put("key", "value"); }}; Map<String, Double> metrics = new HashMap<String, Double>() {{ put("key", 1d); }}; client.trackException(exception, properties, metrics); verifyAndGetLastEventSent(); }
@Override public void run() { tclient.trackException(exception, properties, metrics); } };
@Override public void run() { tclient.trackMetric(mt); } };
@Test public void testTrackTraceAll() { Map<String, String> properties = new HashMap<String, String>() {{ put("key", "value"); }}; client.trackTrace("Trace", SeverityLevel.Error, properties); Telemetry telemetry = verifyAndGetLastEventSent(); verifyTraceTelemetry(telemetry, SeverityLevel.Error, properties); }
@Test public void testTrackTraceWithProperties() { Map<String, String> properties = new HashMap<String, String>() {{ put("key", "value"); }}; client.trackTrace("Trace", null, properties); Telemetry telemetry = verifyAndGetLastEventSent(); verifyTraceTelemetry(telemetry, null, properties); }
@Test public void testTrackMetricWithExpandedValues() { Map<String, String> properties = new HashMap<String, String>() {{ put("key", "value"); }}; client.trackMetric("Metric", 1, 1, 1, 1, properties); verifyAndGetLastEventSent(); }
/** * Gets the channel used by the client. */ TelemetryChannel getChannel() { if (this.channel == null) { this.channel = configuration.getChannel(); } return this.channel; }
@Override public void run() { tclient.trackPageView(pvt); } };
/** * Constructs new telemetry client proxy instance. * @param instrumentationKey The instrumentation key for sending the events. */ public LogTelemetryClientProxy(String instrumentationKey) { this(new TelemetryClient(), instrumentationKey); }
/** * Sends a request record to Application Insights. Appears in "requests" in Search and Analytics, * and contributes to metric charts such as Server Requests, Server Response Time, Failed Requests. * * @param request request */ public void trackRequest(RequestTelemetry request) { track(request); }
@Override public void run() { tclient.trackMetric(name, value, sampleCount, min, max, properties); } };
@Override public void run() { tclient.trackTrace(message, severityLevel, properties); } };
@Override public void run() { tclient.trackPageView(name); } };
@Override public void run() { tclient.trackMetric(name, value); } };