Skip to content

Commit

Permalink
Remove trial-id and trial-timestamp (#979)
Browse files Browse the repository at this point in the history
With this commit we remove the properties `trial-id` and
`trial-timestamp` as they have been replaced by `race-id` and
`race-timestamp` in Rally 1.4.0 and were only present for backwards
compatibility.

Closes #777
  • Loading branch information
danielmitterdorfer authored May 4, 2020
1 parent e3bd681 commit a797985
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 98 deletions.
5 changes: 5 additions & 0 deletions docs/migrate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ Apply to the following changes for each custom runner:

For more details please refer to the updated documentation on :ref:`custom runners <adding_tracks_custom_runners>`.

``trial-id`` and ``trial-timestamp`` are removed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Since Rally 1.4.0, Rally uses the properties ``race-id`` and ``race-timestamp`` when writing data to the Elasticsearch metrics store. The properties ``trial-id`` and ``trial-timestamp`` were populated but are removed in this release. Any visualizations that still rely on these properties need to be changed to the new ones.

Migrating to Rally 1.4.1
------------------------

Expand Down
39 changes: 8 additions & 31 deletions esrally/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,6 @@ def _put_metric(self, level, level_key, name, value, unit, task, operation, oper
doc = {
"@timestamp": time.to_epoch_millis(absolute_time),
"relative-time": int(relative_time * 1000 * 1000),
# TODO #777: Remove trial-* with a later release. They are only here for BWC
"trial-id": self._race_id,
"trial-timestamp": self._race_timestamp,
"race-id": self._race_id,
"race-timestamp": self._race_timestamp,
"environment": self._environment_name,
Expand Down Expand Up @@ -650,9 +647,6 @@ def put_doc(self, doc, level=None, node_name=None, meta_data=None, absolute_time
doc.update({
"@timestamp": time.to_epoch_millis(absolute_time),
"relative-time": int(relative_time * 1000 * 1000),
# TODO #777: Remove trial-* with a later release. They are only here for BWC
"trial-id": self._race_id,
"trial-timestamp": self._race_timestamp,
"race-id": self._race_id,
"race-timestamp": self._race_timestamp,
"environment": self._environment_name,
Expand Down Expand Up @@ -1005,8 +999,7 @@ def _query_by_name(self, name, task, operation_type, sample_type, node_name):
"filter": [
{
"term": {
# TODO #777: Switch to "race-id" once we remove the trial-id parameter
"trial-id": self._race_id
"race-id": self._race_id
}
},
{
Expand Down Expand Up @@ -1288,9 +1281,6 @@ def as_dict(self):
"rally-version": self.rally_version,
"rally-revision": self.rally_revision,
"environment": self.environment_name,
# TODO #777: Remove trial-* with a later release. They are only here for BWC
"trial-id": self.race_id,
"trial-timestamp": time.to_iso8601(self.race_timestamp),
"race-id": self.race_id,
"race-timestamp": time.to_iso8601(self.race_timestamp),
"pipeline": self.pipeline,
Expand Down Expand Up @@ -1326,9 +1316,6 @@ def to_result_dicts(self):
"rally-version": self.rally_version,
"rally-revision": self.rally_revision,
"environment": self.environment_name,
# TODO #777: Remove trial-* with a later release. They are only here for BWC
"trial-id": self.race_id,
"trial-timestamp": time.to_iso8601(self.race_timestamp),
"race-id": self.race_id,
"race-timestamp": time.to_iso8601(self.race_timestamp),
"distribution-version": self.distribution_version,
Expand Down Expand Up @@ -1366,21 +1353,13 @@ def to_result_dicts(self):

@classmethod
def from_dict(cls, d):
# for backwards compatibility with Rally < 0.9.2
if "user-tag" in d:
user_tags = extract_user_tags_from_string(d["user-tag"])
elif "user-tags" in d:
user_tags = d["user-tags"]
else:
user_tags = {}
user_tags = d.get("user-tags", {})
# TODO: cluster is optional for BWC. This can be removed after some grace period.
# TODO #777: Remove the backwards-compatibility layer with trial*
cluster = d.get("cluster", {})
return Race(d["rally-version"], d.get("rally-revision"), d["environment"], d.get("race-id", d.get("trial-id")),
time.from_is8601(d.get("race-timestamp", d.get("trial-timestamp"))),
d["pipeline"], user_tags, d["track"], d.get("track-params"), d.get("challenge"), d["car"],
d.get("car-params"), d.get("plugin-params"), track_revision=d.get("track-revision"),
team_revision=cluster.get("team-revision"),
return Race(d["rally-version"], d.get("rally-revision"), d["environment"], d["race-id"],
time.from_is8601(d["race-timestamp"]), d["pipeline"], user_tags, d["track"], d.get("track-params"),
d.get("challenge"), d["car"], d.get("car-params"), d.get("plugin-params"),
track_revision=d.get("track-revision"), team_revision=cluster.get("team-revision"),
distribution_version=cluster.get("distribution-version"),
distribution_flavor=cluster.get("distribution-flavor"),
revision=cluster.get("revision"), results=d.get("results"), meta_data=d.get("meta", {}))
Expand Down Expand Up @@ -1514,8 +1493,7 @@ def list(self):
"size": self._max_results(),
"sort": [
{
# TODO #777: Switch to "race-timestamp" once we remove the trial-timestamp parameter
"trial-timestamp": {
"race-timestamp": {
"order": "desc"
}
}
Expand All @@ -1539,8 +1517,7 @@ def find_by_race_id(self, race_id):
},
{
"term": {
# TODO #777: Switch to "race-id" once we remove the trial-id parameter
"trial-id": race_id
"race-id": race_id
}
}]

Expand Down
12 changes: 0 additions & 12 deletions esrally/resources/metrics-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@
"relative-time": {
"type": "long"
},
"trial-id": {
"type": "keyword"
},
"trial-timestamp": {
"type": "date",
"format": "basic_date_time_no_millis",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"race-id": {
"type": "keyword"
},
Expand Down
12 changes: 0 additions & 12 deletions esrally/resources/races-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
"enabled": true
},
"properties": {
"trial-id": {
"type": "keyword"
},
"trial-timestamp": {
"type": "date",
"format": "basic_date_time_no_millis",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"race-id": {
"type": "keyword"
},
Expand Down
12 changes: 0 additions & 12 deletions esrally/resources/results-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
"enabled": true
},
"properties": {
"trial-id": {
"type": "keyword"
},
"trial-timestamp": {
"type": "date",
"format": "basic_date_time_no_millis",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"race-id": {
"type": "keyword"
},
Expand Down
36 changes: 5 additions & 31 deletions tests/metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ def test_put_value_without_meta_info(self):
"@timestamp": StaticClock.NOW * 1000,
"race-id": EsMetricsTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsMetricsTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"relative-time": 0,
"environment": "unittest",
"sample-type": "normal",
Expand Down Expand Up @@ -340,8 +338,6 @@ def test_put_value_with_explicit_timestamps(self):
"@timestamp": 0,
"race-id": EsMetricsTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsMetricsTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"relative-time": 10000000,
"environment": "unittest",
"sample-type": "normal",
Expand Down Expand Up @@ -378,8 +374,6 @@ def test_put_value_with_meta_info(self):
self.metrics_store.put_value_node_level("node0", "indexing_throughput", throughput, "docs/s")
expected_doc = {
"@timestamp": StaticClock.NOW * 1000,
"trial-id": EsMetricsTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"race-id": EsMetricsTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"relative-time": 0,
Expand Down Expand Up @@ -420,8 +414,6 @@ def test_put_doc_no_meta_data(self):
"@timestamp": StaticClock.NOW * 1000,
"race-id": EsMetricsTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsMetricsTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"relative-time": 0,
"environment": "unittest",
"track": "test",
Expand Down Expand Up @@ -467,8 +459,6 @@ def test_put_doc_with_metadata(self):
"@timestamp": StaticClock.NOW * 1000,
"race-id": EsMetricsTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsMetricsTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"relative-time": 0,
"environment": "unittest",
"track": "test",
Expand Down Expand Up @@ -520,7 +510,7 @@ def test_get_value(self):
"filter": [
{
"term": {
"trial-id": EsMetricsTests.RACE_ID
"race-id": EsMetricsTests.RACE_ID
}
},
{
Expand Down Expand Up @@ -564,7 +554,7 @@ def test_get_per_node_value(self):
"filter": [
{
"term": {
"trial-id": EsMetricsTests.RACE_ID
"race-id": EsMetricsTests.RACE_ID
}
},
{
Expand Down Expand Up @@ -614,7 +604,7 @@ def test_get_mean(self):
"filter": [
{
"term": {
"trial-id": EsMetricsTests.RACE_ID
"race-id": EsMetricsTests.RACE_ID
}
},
{
Expand Down Expand Up @@ -665,7 +655,7 @@ def test_get_median(self):
"filter": [
{
"term": {
"trial-id": EsMetricsTests.RACE_ID
"race-id": EsMetricsTests.RACE_ID
}
},
{
Expand Down Expand Up @@ -794,7 +784,7 @@ def _get_error_rate(self, buckets):
"filter": [
{
"term": {
"trial-id": EsMetricsTests.RACE_ID
"race-id": EsMetricsTests.RACE_ID
}
},
{
Expand Down Expand Up @@ -862,8 +852,6 @@ def test_find_existing_race_by_race_id(self):
"environment": "unittest",
"race-id": EsRaceStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsRaceStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"pipeline": "from-sources",
"track": "unittest",
"challenge": "index",
Expand Down Expand Up @@ -938,8 +926,6 @@ def test_store_race(self):
"environment": "unittest",
"race-id": EsRaceStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsRaceStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"pipeline": "from-sources",
"user-tags": {
"os": "Linux"
Expand Down Expand Up @@ -1048,8 +1034,6 @@ def test_store_results(self):
"environment": "unittest",
"race-id": EsResultsStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsResultsStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"distribution-flavor": "oss",
"distribution-version": "5.0.0",
"distribution-major-version": 5,
Expand Down Expand Up @@ -1080,8 +1064,6 @@ def test_store_results(self):
"environment": "unittest",
"race-id": EsResultsStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsResultsStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"distribution-flavor": "oss",
"distribution-version": "5.0.0",
"distribution-major-version": 5,
Expand Down Expand Up @@ -1118,8 +1100,6 @@ def test_store_results(self):
"environment": "unittest",
"race-id": EsResultsStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsResultsStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"distribution-flavor": "oss",
"distribution-version": "5.0.0",
"distribution-major-version": 5,
Expand Down Expand Up @@ -1197,8 +1177,6 @@ def test_store_results_with_missing_version(self):
"environment": "unittest",
"race-id": EsResultsStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsResultsStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"distribution-flavor": None,
"distribution-version": None,
"user-tags": {
Expand All @@ -1225,8 +1203,6 @@ def test_store_results_with_missing_version(self):
"environment": "unittest",
"race-id": EsResultsStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsResultsStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"distribution-flavor": None,
"distribution-version": None,
"user-tags": {
Expand Down Expand Up @@ -1259,8 +1235,6 @@ def test_store_results_with_missing_version(self):
"environment": "unittest",
"race-id": EsResultsStoreTests.RACE_ID,
"race-timestamp": "20160131T000000Z",
"trial-id": EsResultsStoreTests.RACE_ID,
"trial-timestamp": "20160131T000000Z",
"distribution-flavor": None,
"distribution-version": None,
"user-tags": {
Expand Down

0 comments on commit a797985

Please sign in to comment.