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_statsd(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_reports = { | expected_reports = { | ||||
# 4 because 2 for the copied objects + 2 for the in_dst ones | |||||
f"^{prefix}_retries_total:1[|]c[|]#attempt:1,operation:obj_in_objstorage$": 4, | |||||
f"^{prefix}_retries_total:1[|]c[|]#attempt:1,operation:get_object$": 2, | |||||
f"^{prefix}_retries_total:1[|]c[|]#attempt:1,operation:put_object$": 2, | |||||
f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:get$": 2, | f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:get$": 2, | ||||
f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:put$": 2, | f"^{prefix}_duration_seconds:[0-9]+[.][0-9]+[|]ms[|]#request:put$": 2, | ||||
f"^{prefix}_bytes:4[|]c$": 2, | f"^{prefix}_bytes:4[|]c$": 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) | ||||
Show All 25 Lines |