async function getBeacons(opts = {}) {
  const json = await fs.readFile(BEACON_FILE, 'utf-8');
  const allBeacons = json.trim().split('\n').filter(Boolean).map(JSON.parse);

  if (allBeacons.length) {
    const lastBeacon = allBeacons.findLast((beacon) => {
      if (opts.instance) {
        return opts.instance === beacon.instance;
      }
      return true;
    });

    if (lastBeacon) {
      return allBeacons.filter((beacon) => {
        if (beacon.id === lastBeacon.id) {
          if (opts.instance) {
            return opts.instance === beacon.instance;
          }
          return true;
        }
        return false;
      });
    }
  }
  return [];
}
Returns an array of beacons matching the passed `opts` object. If no
`opts` are specified, the default is to return all beacon matching
the most recently-received metric ID.