def _add_metric(self, metrics, metric_path, data, data_path):
        """If the path specified by data_path (a list) exists in data,
        add to metrics.  Use when the data path may not be present"""
        current_item = data
        for path_element in data_path:
            current_item = current_item.get(path_element)
            if current_item is None:
                return

        self._set_or_sum_metric(metrics, metric_path, current_item)
If the path specified by data_path (a list) exists in data,
        add to metrics.  Use when the data path may not be present
src/collectors/elasticsearch/elasticsearch.py