function _getEcsContainerId({ agent, callback, logger, recordIdError }) {
  const ecsApiUrl =
    process.env.ECS_CONTAINER_METADATA_URI_V4 || process.env.ECS_CONTAINER_METADATA_URI
  const req = http.request(ecsApiUrl, (res) => {
    let body = Buffer.alloc(0)
    res.on('data', (chunk) => {
      body = Buffer.concat([body, chunk])
    })
    res.on('end', () => {
      try {
        const json = body.toString('utf8')
        const data = JSON.parse(json)
        if (data.DockerId == null) {
          logger.debug({ utilization: 'ecs' }, 'Failed to find DockerId in response, omitting boot info')
          recordIdError(agent)
          return callback(null, null)
        }
        callback(null, data.DockerId)
      } catch (error) {
        logger.debug({ utilization: 'ecs' }, 'Failed to process ECS API response, omitting boot info: ' + error.message)
        recordIdError(agent)
        callback(null, null)
      }
    })
  })

  req.on('error', () => {
    logger.debug({ utilization: 'ecs' }, 'Failed to query ECS endpoint, omitting boot info')
    recordIdError(agent)
    callback(null, null)
  })

  req.end()
}
Queries the AWS ECS metadata API to get the boot id.

@param {object} params Function parameters.
@param {object} params.agent Newrelic agent instance.
@param {Function} params.callback Typical error first callback. The second
parameter is the boot id as a string.
@param {object} params.logger Internal logger instance.
@param {function} params.recordIdError Function to record error metric.