List all Elasticsearch APIs Rally is using
pquentin opened this issue · 2 comments
pquentin commented
In Elasticsearch serverless, various APIs won't be available. We need to know what APIs Rally is using to help with the decision making.
I see two options:
- Look at the source code, but then finding all uses of the Elasticsearch Python client and translating that to strings like
/_nodes/stats
. Looking at the runner and and telemetry devices should cover most of it, but it won't cover whatever tracks are doing by themselves. - Run the rally-tracks-compat job and patch the Python client to print the APIs it is actually calling. We would then have to remove identifiers (eg. outputting
/_ml/anomaly_detectors/{job_id}/_open
without the actual job id) and complete that list with things that job will not have exercised (mostly the various telemetry devices that call Elasticsearch APIs)
b-deam commented
We can use something like this to capture the API calls to the target:
diff --git a/esrally/client/asynchronous.py b/esrally/client/asynchronous.py
index bc05354cf711f027886e09f17db750f0d54fd304..4c8cdd01b60e886b2b3e1d1a2bc76cba779102b5 100644
--- a/esrally/client/asynchronous.py
+++ b/esrally/client/asynchronous.py
@@ -337,6 +337,9 @@ class RallyAsyncElasticsearch(AsyncElasticsearch, RequestContextHolder):
else:
target = path
+ with open("rally_es_api_usage.log", "a") as f:
+ f.write(f"{path}\n")
+
meta, resp_body = await self.transport.perform_request(
method,
target,
diff --git a/esrally/client/synchronous.py b/esrally/client/synchronous.py
index 486ccb7a27796c3cf989747f29bae84f063b3698..bfce518ce321894fcfead0e602cc91df626d32f9 100644
--- a/esrally/client/synchronous.py
+++ b/esrally/client/synchronous.py
@@ -181,6 +181,9 @@ class RallySyncElasticsearch(Elasticsearch):
else:
target = path
+ with open("rally_es_api_usage.log", "a") as f:
+ f.write(f"{path}\n")
+
meta, resp_body = self.transport.perform_request(
method,
target,
pquentin commented
Thanks! With this change to capture API calls, I don't think there's anything left to do in this specific issue. Please reopen if I'm mistaked.