forked from mtusi2026/mtusi2026lab6
исправление комментария и исправлена шкала загрузки слотов воркера
This commit is contained in:
+1
-1
@@ -128,7 +128,7 @@ services:
|
||||
|
||||
seaweedfs:
|
||||
image: chrislusf/seaweedfs:4.50
|
||||
command: ["server", "-dir=/data", "-s3", "-s3.config=/run/secrets/s3_config"]
|
||||
command: ["server", "-dir=/data", "-volume.max=16", "-s3", "-s3.config=/run/secrets/s3_config"]
|
||||
secrets: [s3_config]
|
||||
volumes:
|
||||
- s3-data:/data
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
@@ -616,7 +616,7 @@
|
||||
"id": 11,
|
||||
"type": "timeseries",
|
||||
"title": "Загрузка слотов worker",
|
||||
"description": "Отношение выполняемых задач к числу слотов. Снимок каждые 2 с.",
|
||||
"description": "Отношение выполняемых задач к числу слотов. Снимок каждые 2 с, поэтому короткие попытки могут пройти между замерами.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
@@ -642,7 +642,8 @@
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"min": 0
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
|
||||
@@ -328,11 +328,11 @@ def verify_loki(c, g, actor, chat, message_path):
|
||||
timeline = [sample()]
|
||||
total = 0
|
||||
marker = "loki-outage-" + uuid4().hex
|
||||
dropped_trace_id, _, drop_carrier = trace_headers()
|
||||
outage_trace_id, _, outage_carrier = trace_headers()
|
||||
with stopped("loki"):
|
||||
stopped_at = now()
|
||||
written = c.call("POST", message_path, 201, actor=actor, body={"text": marker}, schema="Message",
|
||||
headers={**drop_carrier, "Idempotency-Key": uuid4().hex})["json"]
|
||||
headers={**outage_carrier, "Idempotency-Key": uuid4().hex})["json"]
|
||||
deadline = time.monotonic() + 30
|
||||
next_sample = time.monotonic()
|
||||
while time.monotonic() < deadline:
|
||||
@@ -344,10 +344,13 @@ def verify_loki(c, g, actor, chat, message_path):
|
||||
time.sleep(0.12)
|
||||
timeline.append(sample())
|
||||
restarted_at = now()
|
||||
before, during = timeline[0], timeline[-1]
|
||||
enqueue_failed = during["enqueue_failed"] - before["enqueue_failed"]
|
||||
send_failed = during["send_failed"] - before["send_failed"]
|
||||
page = c.call("GET", message_path + "?limit=100", actor=actor, schema="MessagePage")["json"]
|
||||
check(any(msg["id"] == written["id"] for msg in page["items"]), "message written during Loki outage disappeared")
|
||||
|
||||
wait_for(lambda: g.logs(dropped_trace_id) is not None, "Loki query endpoint", timeout=70)
|
||||
wait_for(lambda: g.logs(outage_trace_id) is not None, "Loki query endpoint", timeout=70)
|
||||
wait_for(lambda: exporter("queue_size") == 0, "log queue drain", timeout=50)
|
||||
trace_id, _, carrier = trace_headers()
|
||||
probe = c.call("POST", message_path, 201, actor=actor, body={"text": marker},
|
||||
@@ -355,16 +358,18 @@ def verify_loki(c, g, actor, chat, message_path):
|
||||
wait_for(lambda: g.logs(trace_id), "post-outage logs", timeout=35)
|
||||
wait_for(lambda: exporter("sent_log_records") > timeline[-1]["sent"], "post-outage Prometheus scrape")
|
||||
timeline.append(sample())
|
||||
before, after = timeline[0], timeline[-1]
|
||||
after = timeline[-1]
|
||||
estimated_missing = round((after["accepted"] - before["accepted"]) - (after["sent"] - before["sent"]))
|
||||
check(all(0 <= x["queue"] <= x["capacity"] == 8 for x in timeline), "collector queue exceeded its configured bound")
|
||||
check(max(s["rss_bytes"] for s in timeline) < 256 * 1024**2, "collector RSS exceeded its budget")
|
||||
check(collector_started_at() == collector_start, "collector restarted during the outage")
|
||||
check(estimated_missing > 0 and not g.logs(dropped_trace_id) and g.spans(dropped_trace_id),
|
||||
"collector log loss during the outage was not measurable")
|
||||
check(enqueue_failed > 0 or send_failed > 0,
|
||||
"Loki exporter failure counters did not increase during the outage")
|
||||
wait_for(lambda: g.spans(outage_trace_id), "trace for a write during the Loki outage")
|
||||
timeline_summary = {"writes_201_during_outage": total + 1, "persisted_during_outage": True,
|
||||
"probe_201_after_recovery": probe["status"], "resumed_trace_id": trace_id,
|
||||
"dropped_log_trace_id": dropped_trace_id, "estimated_lost_log_records": estimated_missing,
|
||||
"outage_trace_id": outage_trace_id, "estimated_lost_log_records": estimated_missing,
|
||||
"enqueue_failed_log_records": enqueue_failed, "send_failed_log_records": send_failed,
|
||||
"collector_started_at": collector_start}
|
||||
return {"stopped_at": stopped_at, "restarted_at": restarted_at, "timeline": timeline, **timeline_summary}
|
||||
|
||||
@@ -442,6 +447,13 @@ def main():
|
||||
outage_chat = c.call("POST", "/api/v1/chats", 201, actor=actor, schema="Chat",
|
||||
body={"title": "Loki outage", "member_ids": [actor["id"]]})["json"]
|
||||
loki = verify_loki(c, g, actor, outage_chat, f"/api/v1/chats/{outage_chat['id']}/messages")
|
||||
# Both retry-scenario uploads can complete before the first scrape of this histogram.
|
||||
ready_count = "messenger_attachment_time_to_ready_seconds_count"
|
||||
wait_for(lambda: g.scalar(f"sum({ready_count})", optional=True), "initial attachment ready count")
|
||||
attachment, _ = c.attachment(actor, outage_chat)
|
||||
c.wait_ready(actor, attachment)
|
||||
wait_for(lambda: (g.scalar(f"sum(increase({ready_count}[10m]))", optional=True) or 0) > 0,
|
||||
"attachment ready count increased in Prometheus")
|
||||
metrics = verify_metrics(g)
|
||||
history = verify_history(g, queue["trace_id"])
|
||||
summary = {"dashboard": dashboard["title"], "panels": len(dashboard["panels"]), "at": now(),
|
||||
|
||||
Reference in New Issue
Block a user