Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/replayer/tests/test_statsd.py
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | def test_replay_statds(kafka_server, kafka_prefix, kafka_consumer_group, statsd): | ||||
) | ) | ||||
replayer.process(worker_fn) | replayer.process(worker_fn) | ||||
# We cannot expect any order from replayed objects, so statsd reports won't | # We cannot expect any order from replayed objects, so statsd reports won't | ||||
# be sorted according to contents, so we just count the expected occurrence | # be sorted according to contents, so we just count the expected occurrence | ||||
# of each statsd message. | # of each statsd message. | ||||
prefix = "swh_content_replayer" | prefix = "swh_content_replayer" | ||||
expected_report_re = ( | expected_report_re = ( | ||||
f"^{prefix}_retries_total:1[|]c[|]#attempt:1,operation:obj_in_objstorage$", | |||||
f"^{prefix}_retries_total:1[|]c[|]#attempt:1,operation:get_object$", | |||||
f"^{prefix}_retries_total:1[|]c[|]#attempt:1,operation:put_object$", | |||||
f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:get$", | f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:get$", | ||||
f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:put$", | f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:put$", | ||||
f"^{prefix}_bytes:4[|]c$", | f"^{prefix}_bytes:4[|]c$", | ||||
) | ) | ||||
expected_reports = ( | expected_reports = ( | ||||
2, | 4, # 2 for the copied objects + 2 for the in_dst ones | ||||
2, | 2, # copied objects | ||||
2, | 2, # " | ||||
2, # " | |||||
2, # " | |||||
2, # " | |||||
) | ) | ||||
decisions = ("copied", "skipped", "excluded", "in_dst", "not_in_src", "failed") | decisions = ("copied", "skipped", "excluded", "in_dst", "not_in_src", "failed") | ||||
decision_re = ( | decision_re = ( | ||||
"^swh_content_replayer_operations_total:1[|]c[|]#decision:(?P<decision>" | "^swh_content_replayer_operations_total:1[|]c[|]#decision:(?P<decision>" | ||||
+ "|".join(decisions) | + "|".join(decisions) | ||||
+ ")(?P<extras>,.+)?$" | + ")(?P<extras>,.+)?$" | ||||
) | ) | ||||
Show All 23 Lines |