def end_snapshot(self,ts=None,group_by=None,filter_by=None):

        if ts is None:
            now = datetime.now()
        else:
            now = ts

        # We flush before, by checking if the new snapshot
        # is in the same group as the one before and if
        # the flush interval is correct
        self._flush_if_needed(now)

        if self._current_ts is None:
            self._current_ts = now
        if group_by is not None or filter_by is not None:
            self._snapshots.extend(
                self._aggregate(self._current_snapshot,
                                group_by = group_by,
                                filter_by = filter_by,
                                temporal = False))
        else:
            self._snapshots.extend(self._current_snapshot)

        self._current_snapshot = None
End the current snapshot:
dataset/ETHPy150Open serverdensity/sd-agent/resources/__init__.py/ResourcePlugin.end_snapshot