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

Warn on request errors #1035

Merged
merged 3 commits into from
Aug 4, 2020
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
7 changes: 4 additions & 3 deletions esrally/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1615,8 +1615,9 @@ def __call__(self):

for tasks in self.challenge.schedule:
for task in tasks:
if task.operation.include_in_reporting:
t = task.name
t = task.name
error_rate = self.error_rate(t)
if task.operation.include_in_reporting or error_rate > 0:
self.logger.debug("Gathering request metrics for [%s].", t)
result.add_op_metrics(
t,
Expand All @@ -1625,7 +1626,7 @@ def __call__(self):
self.single_latency(t),
self.single_latency(t, metric_name="service_time"),
self.single_latency(t, metric_name="processing_time"),
self.error_rate(t),
error_rate,
self.merge(
self.track.meta_data,
self.challenge.meta_data,
Expand Down
2 changes: 2 additions & 0 deletions esrally/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def report(self):
console.warn(warning)

def add_warnings(self, warnings, values, op):
if values["error_rate"] > 0:
warnings.append(f"Error rate is {round(values['error_rate'] * 100, 2)} for operation '{op}'. Please check the logs.")
if values["throughput"]["median"] is None:
error_rate = values["error_rate"]
if error_rate:
Expand Down
39 changes: 39 additions & 0 deletions tests/metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import elasticsearch.exceptions

from esrally import config, metrics, track, exceptions, paths
from esrally.metrics import GlobalStatsCalculator
from esrally.track import Task, Operation, Challenge, Track


class MockClientFactory:
Expand Down Expand Up @@ -1614,6 +1616,43 @@ def select(l, name, operation=None, job=None, node=None):
return None


class GlobalStatsCalculatorTests(TestCase):
RACE_TIMESTAMP = datetime.datetime(2016, 1, 31)
RACE_ID = "fb26018b-428d-4528-b36b-cf8c54a303ec"

def setUp(self):
self.cfg = config.Config()
self.cfg.add(config.Scope.application, "system", "env.name", "unittest")
self.cfg.add(config.Scope.application, "track", "params", {})
self.metrics_store = metrics.InMemoryMetricsStore(self.cfg, clock=StaticClock)

def tearDown(self):
del self.metrics_store
del self.cfg

def test_add_administrative_task_with_error_rate_in_report(self):
op = Operation(name='delete-index', operation_type='DeleteIndex', params={'include-in-reporting': False})
task = Task('delete-index', operation=op, schedule='deterministic')
challenge = Challenge(name='append-fast-with-conflicts', schedule=[task], meta_data={})

self.metrics_store.open(InMemoryMetricsStoreTests.RACE_ID, InMemoryMetricsStoreTests.RACE_TIMESTAMP,
"test", "append-fast-with-conflicts", "defaults", create=True)
self.metrics_store.put_doc(doc={"@timestamp": 1595896761994, "relative-time": 283382,
"race-id": "fb26018b-428d-4528-b36b-cf8c54a303ec",
"race-timestamp": "20200728T003905Z", "environment": "local",
"track": "geonames", "challenge": "append-fast-with-conflicts",
"car": "defaults", "name": "service_time", "value": 72.67997100007051,
"unit": "ms", "sample-type": "normal",
"meta": {"source_revision": "7f634e9f44834fbc12724506cc1da681b0c3b1e3",
"distribution_version": "7.6.0", "distribution_flavor": "oss",
"success": False}, "task": "delete-index", "operation": "delete-index",
"operation-type": "DeleteIndex"})

result = GlobalStatsCalculator(store=self.metrics_store, track=Track(name='geonames', meta_data={}),
challenge=challenge)()
assert "delete-index" in [op_metric.get('task') for op_metric in result.op_metrics]


class GlobalStatsTests(TestCase):
def test_as_flat_list(self):
d = {
Expand Down