@Override public void run() { tclient.trackDependency(dependencyName, commandName, duration, success); } };
@Override public void run() { tclient.trackDependency(rdt); } };
public void trackDependency(String dependencyName, String commandName, Duration duration, boolean success) { RemoteDependencyTelemetry remoteDependencyTelemetry = new RemoteDependencyTelemetry(dependencyName, commandName, duration, success); trackDependency(remoteDependencyTelemetry); }
private void sendHTTPTelemetry(MethodData methodData, Throwable throwable) { if (methodData.arguments != null && methodData.arguments.length == 1) { String url = methodData.arguments[0].toString(); long durationInMilliSeconds = nanoToMilliseconds(methodData.interval); Duration duration = new Duration(durationInMilliSeconds); InternalLogger.INSTANCE.trace("Sending HTTP RDD event, URL: '%s', duration=%s ms", url, durationInMilliSeconds); RemoteDependencyTelemetry telemetry = new RemoteDependencyTelemetry(url, null, duration, throwable == null); telemetry.setDependencyKind(DependencyKind.Http); Date dependencyStartDate = new Date(System.currentTimeMillis() - durationInMilliSeconds); telemetry.setTimestamp(dependencyStartDate); telemetryClient.trackDependency(telemetry); if (throwable != null) { ExceptionTelemetry exceptionTelemetry = new ExceptionTelemetry(throwable); telemetryClient.track(exceptionTelemetry); } } }
appInsights.trackDependency(remoteDependencyTelemetry); System.out.println("[7] Remote Dependency -- DependencyName, commandName, 61001 ms, success = true.");