import ApplicationInsights = require ( "applicationinsights" ) ; import { channel , IStandardEvent } from "diagnostic-channel" ; import { redis } from "diagnostic-channel-publishers" ; export const subscriber = ( event ) => { if ( ApplicationInsights . defaultClient ) { if ( event . data . commandObj . command === "redis" ) { return ; } ApplicationInsights . defaultClient . trackDependency ( { target : event . data . address , name : event . data . commandObj . command , data : event . data . commandObj . command , duration : event . data . duration , success : ! event . data . err , resultCode : event . data . err ? "1" : "0" , dependencyTypeName : "redis" } ) ; } } ; channel . subscribe < redis . IRedisData > ( "redis" , subscriber ) ;