async sendAnonymousMetric()

in source/resources/solution-helper/lib/metrics-helper.js [29:55]


  async sendAnonymousMetric(metric) {
    console.log('RESPONSE BODY:\n', responseBody); 
    const parsedUrl = url.parse(event.ResponseURL); 
    const options = { 
        hostname: this.endpoint, 
        port: 443,
        method: 'POST', 
        headers: { 
            'Content-Type': 'application/json', 
            'Content-Length': metric.length, 
        } 
    }; 
 
    const req = https.request(options, (res) => { 
        console.log('STATUS:', res.statusCode); 
        console.log('HEADERS:', JSON.stringify(res.headers)); 
        callback(null, 'Successfully sent stack response!'); 
    }); 
 
    req.on('error', (err) => { 
        console.log('sendResponse Error:\n', err); 
        callback(err); 
    }); 
 
    req.write(JSON.stringify(metric)); 
    req.end();
  }