import appInsights = require ( 'applicationinsights' ) ; export class TelemetryService { client ! : appInsights . TelemetryClient ; constructor ( disableTelemetry , instrumentationKey ) { if ( ! disableTelemetry ) { appInsights . setup ( instrumentationKey ) ; this . client = appInsights . defaultClient ; appInsights . defaultClient . commonProperties = { task : 'Net Framework' , version : '#{ExtensionVersion}#' , } ; appInsights . start ( ) ; } } trackEvent ( message ) { if ( this . client ) { this . client . trackEvent ( { name : message } ) ; } } trackException ( message ) { if ( this . client ) { this . client . trackException ( { exception : new Error ( message ) } ) ; } } }