async sendAnonymousMetric()

in source/utils/metrics.ts [40:59]


    async sendAnonymousMetric(metricProperties: IAnonymousMetricProperties): Promise<void> {
        try {
            const metricPayload = Object.assign({ TimeStamp: moment().utc().format('YYYY-MM-DD HH:mm:ss.S') }, metricProperties);
            const params = {
                method: 'post',
                port: 443,
                url: this.endpoint,
                headers: {
                    'Content-Type': 'application/json'
                },
                data: metricPayload
            };

            console.log(`Sending anonymous metric: ${JSON.stringify(metricPayload)}`);
            await axios(params);
        } catch (error) {
            // Only logging the error and throwing it up to avoid Metrics affecting the Application
            console.error(`Error occurred while sending metric: ${JSON.stringify(error)}`);
        }
    }