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

Use composable index templates for metric indices #1811

Merged
merged 7 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions docs/migrate.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Migration Guide
===============

Migrating to Rally 2.10.1
-------------------------

The metrics store now uses composable templates
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* Existing legacy index templates are not removed, however, composable templates take precedence (applies to races, results, and metrics).
* The new templates will be applied when new races, results, and metrics indices are created.
* The index template for annotations will only be applied if the ``rally-annotations`` index is not present.

Migrating to Rally 2.10.0
-------------------------

Expand Down
11 changes: 4 additions & 7 deletions esrally/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ def __init__(self, client, cluster_version=None):

def put_template(self, name, template):
tmpl = json.loads(template)
return self.guarded(self._client.indices.put_template, name=name, **tmpl)
return self.guarded(self._client.indices.put_index_template, name=name, **tmpl)

def template_exists(self, name):
return self.guarded(self._client.indices.exists_template, name=name)

def delete_template(self, name):
self.guarded(self._client.indices.delete_template, name=name)
return self.guarded(self._client.indices.exists_index_template, name=name)

def delete_by_query(self, index, body):
return self.guarded(self._client.delete_by_query, index=index, body=body)
Expand Down Expand Up @@ -314,9 +311,9 @@ def _read(self, template_name):
f"The setting: datastore.number_of_shards must be >= 1. Please "
f"check the configuration in {self._config.config_file.location}"
)
template["settings"]["index"]["number_of_shards"] = int(self._number_of_shards)
template["template"]["settings"]["index"]["number_of_shards"] = int(self._number_of_shards)
if self._number_of_replicas is not None:
template["settings"]["index"]["number_of_replicas"] = int(self._number_of_replicas)
template["template"]["settings"]["index"]["number_of_replicas"] = int(self._number_of_replicas)
return json.dumps(template)


Expand Down
85 changes: 44 additions & 41 deletions esrally/resources/annotation-template.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
{
"index_patterns": ["rally-annotations"],
"settings": {
"index":{
}
},
"mappings": {
"dynamic_templates": [
{
"strings": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
"index_patterns": [
"rally-annotations"
],
"template": {
"settings": {
"index": {}
},
"mappings": {
"dynamic_templates": [
{
"strings": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
}
],
"properties": {
"environment": {
"type": "keyword"
},
"race-timestamp": {
"type": "date",
"fields": {
"raw": {
"type": "keyword"
}
],
"properties": {
"environment": {
"type": "keyword"
},
"race-timestamp": {
"type": "date",
"fields": {
"raw": {
"type": "keyword"
}
},
"format": "basic_date_time_no_millis"
},
"user-tag": {
"type": "keyword"
},
"format": "basic_date_time_no_millis"
},
"user-tag": {
"type": "keyword"
},
"track": {
"type": "keyword"
},
"chart": {
"type": "keyword"
},
"chart-name": {
"type": "keyword"
},
"message": {
"type": "keyword"
"track": {
"type": "keyword"
},
"chart": {
"type": "keyword"
},
"chart-name": {
"type": "keyword"
},
"message": {
"type": "keyword"
}
}
}
}
Expand Down
176 changes: 90 additions & 86 deletions esrally/resources/metrics-template.json
Original file line number Diff line number Diff line change
@@ -1,94 +1,98 @@
{
"index_patterns": ["rally-metrics-*"],
"settings": {
"index": {
"mapping.total_fields.limit": 2000
}
},
"mappings": {
"date_detection": false,
"dynamic_templates": [
{
"strings": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
"index_patterns": [
"rally-metrics-*"
],
"template": {
"settings": {
"index": {
"mapping.total_fields.limit": 2000
}
],
"_source": {
"enabled": true
},
"properties": {
"@timestamp": {
"type": "date",
"format": "epoch_millis"
},
"relative-time": {
"type": "float"
},
"race-id": {
"type": "keyword"
},
"race-timestamp": {
"type": "date",
"format": "basic_date_time_no_millis",
"fields": {
"raw": {
"type": "keyword"
"mappings": {
"date_detection": false,
"dynamic_templates": [
{
"strings": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
},
"environment": {
"type": "keyword"
},
"track": {
"type": "keyword"
},
"challenge": {
"type": "keyword"
},
"car": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"value": {
"type": "float"
},
"min": {
"type": "float"
},
"max": {
"type": "float"
},
"mean": {
"type": "float"
},
"median": {
"type": "float"
},
"unit": {
"type": "keyword"
},
"sample-type": {
"type": "keyword"
},
"task": {
"type": "keyword"
},
"operation": {
"type": "keyword"
},
"operation-type": {
"type": "keyword"
},
"job": {
"type": "keyword"
],
"_source": {
"enabled": true
},
"properties": {
"@timestamp": {
"type": "date",
"format": "epoch_millis"
},
"relative-time": {
"type": "float"
},
"race-id": {
"type": "keyword"
},
"race-timestamp": {
"type": "date",
"format": "basic_date_time_no_millis",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"environment": {
"type": "keyword"
},
"track": {
"type": "keyword"
},
"challenge": {
"type": "keyword"
},
"car": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"value": {
"type": "float"
},
"min": {
"type": "float"
},
"max": {
"type": "float"
},
"mean": {
"type": "float"
},
"median": {
"type": "float"
},
"unit": {
"type": "keyword"
},
"sample-type": {
"type": "keyword"
},
"task": {
"type": "keyword"
},
"operation": {
"type": "keyword"
},
"operation-type": {
"type": "keyword"
},
"job": {
"type": "keyword"
}
}
}
}
}
}
Loading