Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ccr stats endpoint #546

Merged
merged 3 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions esrally/mechanic/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def record(self):
import elasticsearch

try:
ccr_stats_api_endpoint = "/_xpack/ccr/_stats"
ccr_stats_api_endpoint = "/_ccr/stats"
stats = self.client.transport.perform_request("GET", ccr_stats_api_endpoint, params={"human": "false"})
except elasticsearch.TransportError as e:
msg = "A transport error occurred while collecting CCR stats from the endpoint [{}] on " \
Expand Down Expand Up @@ -410,14 +410,17 @@ def record_stats_per_index(self, name, stats):
:param stats: A dict with returned CCR stats for the index.
"""

for shard_num, shard_stats in stats.items():
shard_metadata = {
"cluster": self.cluster_name,
"index": name,
"shard": shard_num
}
for shard_stats in stats:
shard_id = shard_stats.get("shard_id", None)
if shard_id is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a matter of taste but you could also write this as if "shard_id" in shard_stats and then use shard_stats["shard_id"] in the body.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion I prefer this as well; addressed in 581a69f

shard_metadata = {
"cluster": self.cluster_name,
"index": name,
"shard": shard_id,
"name": "ccr-stats"
}

self.metrics_store.put_doc(shard_stats, level=MetaInfoScope.cluster, meta_data=shard_metadata)
self.metrics_store.put_doc(shard_stats, level=MetaInfoScope.cluster, meta_data=shard_metadata)


class NodeStats(TelemetryDevice):
Expand Down
Loading