class MappedMetricDataTimestampExtractor implements TimestampExtractor {

    @Override
    public long extract(ConsumerRecord<Object, Object> record, long previousTimestamp) {
        val mappedMetricData = (MappedMetricData) record.value();
        if (mappedMetricData == null || mappedMetricData.getMetricData() == null) {
            // -1 skips the record. Don't log as it can fill up the logs.
            return -1L;
        }
        return mappedMetricData.getMetricData().getTimestamp() * 1000L;
    }

}