def log_metrics(self, metric_name, metrics_values, info):
        """Store new measurements to the database.

        Take measurements and store them into
        the metrics collection in the database.
        Additionally, reference the metrics
        in the info["metrics"] dictionary.
        """
        if self.metrics is None:
            # If, for whatever reason, the metrics collection has not been set
            # do not try to save anything there.
            return
        query = {"run_id": self.run_entry["_id"], "name": metric_name}
        push = {
            "steps": {"$each": metrics_values["steps"]},
            "values": {"$each": metrics_values["values"]},
            "timestamps": {"$each": metrics_values["timestamps"]},
        }
        update = {"$push": push}
        result = self.metrics.update_one(query, update, upsert=True)
        if result.upserted_id is not None:
            # This is the first time we are storing this metric
            info.setdefault("metrics", []).append(
                {"name": metric_name, "id": str(result.upserted_id)}
            )
Store new measurements to the database.

        Take measurements and store them into
        the metrics collection in the database.
        Additionally, reference the metrics
        in the info["metrics"] dictionary.
        
sacred/observers/mongo.py