in esrally/telemetry.py [0:0]
def record(self):
"""
Collect searchable snapshots stats for indexes (optionally) specified in telemetry parameters
and push to metrics store.
"""
# pylint: disable=import-outside-toplevel
import elasticsearch
try:
stats_api_endpoint = "/_searchable_snapshots/stats"
level = "indices" if self.indices else "cluster"
# we don't use the existing client support (searchable_snapshots.stats())
# as the API is deliberately undocumented and might change:
# https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-stats.html
stats = self.client.perform_request(method="GET", path=stats_api_endpoint, params={"level": level})
except elasticsearch.NotFoundError as e:
if "No searchable snapshots indices found" in e.info.get("error").get("reason"):
self.logger.info(
"Unable to find valid indices while collecting searchable snapshots stats on cluster [%s]", self.cluster_name
)
# allow collection, indices might be mounted later on
return
except elasticsearch.TransportError:
raise exceptions.RallyError(
f"A transport error occurred while collecting searchable snapshots stats on cluster [{self.cluster_name}]"
) from None
total_stats = stats.get("total", [])
for lucene_file_stats in total_stats:
self._push_stats(level="cluster", stats=lucene_file_stats)
if self.indices:
for idx, idx_stats in stats.get("indices", {}).items():
if not self._match_list_or_pattern(idx):
continue
for lucene_file_stats in idx_stats.get("total", []):
self._push_stats(level="index", stats=lucene_file_stats, index=idx)