'use strict' ; import TelemetryReporter from 'vscode-extension-telemetry' ; import { version } from '../../package.json' ; import { ExtensionUtil } from './ExtensionUtil' ; export class Reporter { public static instance ( ) { return this . _instance ; } private static _instance : Reporter = new Reporter ( ) ; private key : string = Buffer . from ( 'M2I5NDRlY2MtYzI0Yy00ODgzLTkxMGItZjg4ZWFlZDkwMTc1' , 'base64' ) . toString ( ) ; private telemetryReporter : TelemetryReporter ; private constructor ( ) { this . telemetryReporter = new TelemetryReporter ( 'IBMBlockchain.ibm-blockchain-platform' , this . getVersion ( ) , this . key ) ; } public sendTelemetryEvent ( eventName , properties ? ) { const packageJson = ExtensionUtil . getPackageJSON ( ) ; if ( packageJson . production === true ) { this . telemetryReporter . sendTelemetryEvent ( eventName , properties ) ; } } public async dispose ( ) { await this . telemetryReporter . dispose ( ) ; } private getVersion ( ) { return version ; } }