@classmethod
def record(cls, timestamp=None, **kwargs):
    """Persist a metric in Elasticsearch.

        :param datetime timestamp: Timestamp for the metric.
        """
    instance = cls(timestamp=timestamp, **kwargs)
    index = cls.get_index_name(timestamp)
    instance.save(index=index)
    return instance
