Update Architecture B diagram and benchmark tooling

This commit is contained in:
Steffen committed 2026-11-24 15:56:03 +01:00
1 parent 6ea20b2365
commit 0b9865d51e
4 files changed
+224 -48

No files matched your search

@@ -1,77 +1,133 @@
<?xml version='1.0' encoding='utf-8'?>
<mxfile host="app.diagrams.net" type="device" compressed="false">
<mxfile host="Electron" compressed="false">
<diagram id="page1" name="Logical components — all in one application process">
<mxGraphModel dx="1500" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1540" pageHeight="1280" math="0" shadow="0">
<mxGraphModel dx="4989" dy="2117" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1540" pageHeight="1280" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="title" value="Logical components — all in one application process" style="text;html=0;align=left;fontSize=24;fontStyle=1;" vertex="1" parent="1">
<mxGeometry as="geometry" x="60" y="25" width="1380" height="45" />
<mxCell id="title" parent="1" style="text;html=0;align=left;fontSize=24;fontStyle=1;" value="Logical components — all in one application process" vertex="1">
<mxGeometry height="45" width="1380" x="60" y="25" as="geometry" />
</mxCell>
<mxCell id="edge" value="API/access&#10;HTTPS endpoint adapters&#10;Login/token validation&#10;Actual-owner / assignment policies&#10;Public guidance exception" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="80" y="120" width="340" height="225" />
<mxCell id="edge" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" value="API/access&#xa;HTTPS endpoint adapters&#xa;Login/token validation&#xa;Actual-owner / assignment policies&#xa;Public guidance exception" vertex="1">
<mxGeometry height="225" width="340" x="-110" y="130" as="geometry" />
</mxCell>
<mxCell id="profile" value="Profile&#10;Initial profile + account association&#10;Create / find / update&#10;ProfileQueries / ProfileCommands" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="540" y="120" width="340" height="225" />
<mxCell id="profile" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" value="Profile&#xa;Initial profile + account association&#xa;Create / find / update&#xa;ProfileQueries / ProfileCommands" vertex="1">
<mxGeometry height="225" width="340" x="540" y="130" as="geometry" />
</mxCell>
<mxCell id="obs" value="Observations&#10;Record / specific / latest / history&#10;Atomic patch and delete&#10;ObservationQueries / Commands" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1000" y="120" width="340" height="225" />
<mxCell id="obs" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" value="Observations&#xa;Record / specific / latest / history&#xa;Atomic patch and delete&#xa;ObservationQueries / Commands" vertex="1">
<mxGeometry height="225" width="340" x="1510" y="120" as="geometry" />
</mxCell>
<mxCell id="overview" value="Overview&#10;Compose profile + latest overall&#10;+ selected-period insight&#10;OverviewQueries; transient result" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="80" y="440" width="340" height="225" />
<mxCell id="overview" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" value="Overview&#xa;Compose profile + latest overall&#xa;+ selected-period insight&#xa;OverviewQueries; transient result" vertex="1">
<mxGeometry height="225" width="340" x="-110" y="460" as="geometry" />
</mxCell>
<mxCell id="analytics" value="Analytics&#10;SummaryPolicy / TrendPolicy&#10;ClinicalPolicy / comparability&#10;AnalyticsQueries; no result store" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="540" y="440" width="340" height="225" />
<mxCell id="analytics" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" value="Analytics&#xa;SummaryPolicy / TrendPolicy&#xa;ClinicalPolicy / comparability&#xa;AnalyticsQueries; no result store" vertex="1">
<mxGeometry height="225" width="340" x="540" y="460" as="geometry" />
</mxCell>
<mxCell id="guidance" value="Guidance&#10;Public ordered instructions&#10;Reviewed reference catalog&#10;Versioned applicability/provenance" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="1000" y="440" width="340" height="225" />
<mxCell id="guidance" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" value="Guidance&#xa;Public ordered instructions&#xa;Reviewed reference catalog&#xa;Versioned applicability/provenance" vertex="1">
<mxGeometry height="225" width="340" x="1510" y="440" as="geometry" />
</mxCell>
<mxCell id="infra" value="Infrastructure&#10;ReadSnapshot / WriteTransaction&#10;Private per-module DB adapters&#10;Bounded DB connection pool" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="540" y="760" width="340" height="225" />
<mxCell id="infra" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#e8f0fe;strokeColor=#355070;fontSize=14;align=left;verticalAlign=middle;spacing=12;" value="Infrastructure&#xa;ReadSnapshot / WriteTransaction&#xa;Private per-module DB adapters&#xa;Bounded DB connection pool" vertex="1">
<mxGeometry height="225" width="340" x="1080" y="280" as="geometry" />
</mxCell>
<mxCell id="edge0" value="Authorized profile operations / association lookup" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="edge" target="profile">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge0" edge="1" parent="1" source="edge" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="profile" value="Authorized profile operations / association lookup">
<mxGeometry relative="1" y="-7" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="edge1" value="Authorized observation operations / actual owner" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="edge" target="obs">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge1" edge="1" parent="1" source="edge" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="obs" value="Authorized observation operations / actual owner">
<mxGeometry relative="1" x="-0.0322" as="geometry">
<Array as="points">
<mxPoint x="-70" y="100" />
<mxPoint x="1680" y="100" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge2" value="Authorized overview" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="edge" target="overview">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge2" edge="1" parent="1" source="edge" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="overview" value="Authorized overview">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="edge3" value="Authorized insight / trend" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="edge" target="analytics">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge3" edge="1" parent="1" source="edge" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="analytics" value="Authorized insight / trend">
<mxGeometry relative="1" x="-0.4374" as="geometry">
<Array as="points">
<mxPoint x="200" y="410" />
<mxPoint x="710" y="410" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge4" value="Public guidance" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="edge" target="guidance">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge4" edge="1" parent="1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" target="guidance" value="Public guidance">
<mxGeometry relative="1" x="0.0091" as="geometry">
<Array as="points">
<mxPoint x="-70" y="70" />
<mxPoint x="1490" y="70" />
<mxPoint x="1490" y="410" />
<mxPoint x="1680" y="410" />
</Array>
<mxPoint x="-70" y="150" as="sourcePoint" />
<mxPoint x="1680" y="460" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="edge5" value="Patient existence, typed query" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="obs" target="profile">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge5" edge="1" parent="1" source="obs" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="profile" value="Patient existence, typed query">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1350" y="190" />
<mxPoint x="1350" y="190" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge6" value="Profile read, same snapshot" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="overview" target="profile">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge6" edge="1" parent="1" source="overview" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="profile" value="Profile read, same snapshot">
<mxGeometry relative="1" x="-0.2497" as="geometry">
<Array as="points">
<mxPoint x="60" y="780" />
<mxPoint x="1010" y="780" />
<mxPoint x="1010" y="242.5" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge7" value="Latest overall read" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="overview" target="obs">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge7" edge="1" parent="1" source="overview" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="obs" value="Latest overall read">
<mxGeometry relative="1" x="-0.1421" as="geometry">
<Array as="points">
<mxPoint x="60" y="860" />
<mxPoint x="1900" y="860" />
<mxPoint x="1900" y="232.5" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge8" value="Selected insight from current series" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="overview" target="analytics">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge8" edge="1" parent="1" source="overview" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="analytics" value="Selected insight from current series">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="edge9" value="Current selected immutable series" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="analytics" target="obs">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge9" edge="1" parent="1" source="analytics" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="obs" value="Current selected immutable series">
<mxGeometry relative="1" x="0.0448" as="geometry">
<Array as="points">
<mxPoint x="1460" y="640" />
<mxPoint x="1460" y="232.5" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge10" value="Claim-specific reference catalog" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="analytics" target="guidance">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge10" edge="1" parent="1" source="analytics" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="guidance" value="Claim-specific reference catalog">
<mxGeometry relative="1" x="-0.0335" as="geometry">
<Array as="points">
<mxPoint x="1195" y="572.5" />
<mxPoint x="1195" y="570" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge11" value="Own repository / transaction" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="profile" target="infra">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge11" edge="1" parent="1" source="profile" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="infra" value="Own repository / transaction">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="940" y="242.5" />
<mxPoint x="940" y="430" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="edge12" value="Own repository / transaction" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" edge="1" parent="1" source="obs" target="infra">
<mxGeometry as="geometry" relative="1" />
<mxCell id="edge12" edge="1" parent="1" source="obs" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=0;fontSize=12;labelBackgroundColor=#ffffff;strokeColor=#46566a;dashed=1;endArrow=open;" target="infra" value="Own repository / transaction">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1310" y="232.5" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="note" value="Solid boxes are logical modules, not independently deployed processes. Dashed arrows are typed in-process dependencies, not network calls. All public operations pass API/access; no callback into routing. Overview uses private module interfaces and shared read snapshot, never another module’s SQL." style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff6df;strokeColor=#b28725;fontSize=13;align=left;spacing=12;" vertex="1" parent="1">
<mxGeometry as="geometry" x="60" y="1090" width="1380" height="115" />
<mxCell id="note" parent="1" style="rounded=0;whiteSpace=wrap;html=0;fillColor=#fff6df;strokeColor=#b28725;fontSize=13;align=left;spacing=12;" value="Solid boxes are logical modules, not independently deployed processes. Dashed arrows are typed in-process dependencies, not network calls. All public operations pass API/access; no callback into routing. Overview uses private module interfaces and shared read snapshot, never another module’s SQL." vertex="1">
<mxGeometry height="115" width="1380" x="120" y="960" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
</mxfile>
Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

@@ -0,0 +1,110 @@
#!/usr/bin/env python3
"""Repeat B idle and review using direct LAN PerfMon; preserve prior evidence."""
import csv
import datetime as dt
import hashlib
import json
import os
import statistics
import subprocess
import sys
import urllib.parse
import urllib.request
from pathlib import Path
import perfmon
import shelly
from tls import application_context
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
PREVIOUS = HERE / "results/loaded-b-corrected-usb-off-26-4h-20261022-run1/run.json"
PRIVATE = HERE / ".private/fresh-20261021"
HOST = "192.168.1.125"
CA = PRIVATE / "healthapp-ca.crt"
USERS = PRIVATE / "dataset/users.csv"
previous = json.loads(PREVIOUS.read_text())
plan_sha = hashlib.sha256((HERE / "plans/review.jmx").read_bytes()).hexdigest()
if plan_sha != previous["plan_sha256"]:
raise SystemExit("Review plan does not match previous B plan; no run started")
if previous["distinct_accounts"] != 1:
raise SystemExit("Previous B measurement did not use the expected single account")
period_from, period_to = previous["period_from"], previous["period_to"]
with USERS.open(newline="") as file:
users = list(csv.DictReader(file))
if len(users) != 1:
raise SystemExit("Expected one previously prepared synthetic patient; no run started")
print("Preflight: connecting directly to test PC PerfMon 192.168.1.125:4444", flush=True)
perfmon.check_agent(HOST, 4444)
shelly.check_plug("192.168.1.44", 80, 0)
context = application_context(cafile=str(CA))
def api(path, token=None, body=None):
headers = {"Content-Type": "application/json"}
if token:
headers["Authorization"] = "Bearer " + token
request = urllib.request.Request(
f"https://{HOST}:5443" + path, headers=headers,
data=json.dumps(body).encode() if body is not None else None,
)
with urllib.request.urlopen(request, context=context, timeout=30) as response:
return json.load(response)
user = users[0]
login = api("/api/authentication/login", body={"accountId": user["account_id"], "password": user["password"]})
token = login["accessToken"]
patient = api("/api/patients/me", token=token)
if patient["patientId"] != user["patient_id"]:
raise SystemExit("Prepared account does not match test patient; no run started")
query = urllib.parse.urlencode({"from": period_from, "to": period_to})
path = f"/api/patients/{user['patient_id']}/observations?{query}"
history = api(path, token=token)
selected = api(path + "&setting=Home&activityCondition=AtRest", token=token)
if len(history) != 60 or len(selected) != 42:
raise SystemExit(f"Dataset differs from prepared 60 readings / 42 home-rest readings: {len(history)} / {len(selected)}; no run started")
print("Direct PerfMon, Shelly, HTTPS and prepared patient dataset preflight passed.", flush=True)
print("The direct connection must remain available; failed monitoring invalidates the run.", flush=True)
timestamp = dt.datetime.now(dt.timezone.utc).strftime("%Y%m%dT%H%M%SZ")
control = HERE / "results" / ("direct-b-" + timestamp)
control.mkdir(mode=0o700, parents=True, exist_ok=False)
metadata = {
"started_utc": dt.datetime.now(dt.timezone.utc).isoformat(),
"monitoring": "direct TCP 192.168.1.125:4444; no SSH forwarding",
"plan_sha256": plan_sha,
"period_from": period_from, "period_to": period_to,
"patient_observations": len(history), "home_at_rest_observations": len(selected),
"previous_run": str(PREVIOUS),
"note": "Dataset counts were checked; exact input values, monitoring overhead, USB state and machine configuration require separate verification.",
}
(control / "experiment.json").write_text(json.dumps(metadata, indent=2) + "\n")
base = [sys.executable, "-u", str(HERE / "run.py"), "--host", HOST,
"--perfmon-host", HOST, "--perfmon-port", "4444", "--shelly-host", "192.168.1.44",
"--warmup", "1800", "--duration", "14400", "--perfmon-interval-ms", "1000",
"--shelly-interval-ms", "1000", "--period-from", period_from, "--period-to", period_to]
for scenario in ("idle", "review"):
output = control / scenario
args = [*base, scenario, "--output", str(output)]
if scenario == "idle":
args += ["--ramp", "0"]
else:
args += ["--ramp", "60", "--users", "26", "--users-file", str(USERS), "--ca", str(CA),
"--allow-shared-read-account", "--capacity-trial", "--think-min-ms", "500",
"--think-mean-ms", "1000", "--think-stddev-ms", "250", "--session-pause-ms", "0",
"--session-stddev-ms", "0", "--seed", "42"]
print(f"Starting {scenario}: 30-minute warmup and four-hour measurement; output {output}", flush=True)
result = subprocess.run(args, cwd=ROOT, env=dict(os.environ, MPLCONFIGDIR="/tmp/healthapp-b-direct-matplotlib"))
if result.returncode:
raise SystemExit(f"{scenario} failed with exit code {result.returncode}; retained evidence in {control}")
run = json.loads((output / "run.json").read_text())
if scenario == "review":
with (output / "measured.csv").open(newline="") as file:
samples = list(csv.DictReader(file))
mean = statistics.mean(int(row["elapsed"]) for row in samples)
if run["measured_failed_http_samples"] != 0 or mean >= 200:
raise SystemExit(f"Review did not meet criteria: mean={mean:.3f} ms, failures={run['measured_failed_http_samples']}; retained evidence in {control}")
print(f"Review criteria passed: mean {mean:.3f} ms, zero HTTP failures.", flush=True)
print(f"Both direct-monitoring runs complete; evidence: {control}", flush=True)
+10
View File
@@ -15,6 +15,8 @@ p.add_argument('--warmup',type=int,default=1800);p.add_argument('--duration',typ
p.add_argument('--think-min-ms',type=int,default=500);p.add_argument('--think-mean-ms',type=int,default=1000);p.add_argument('--think-stddev-ms',type=int,default=250)
p.add_argument('--session-pause-ms',type=int,default=120000)
p.add_argument('--session-stddev-ms',type=int,default=30000);p.add_argument('--seed',type=int,default=42)
p.add_argument('--period-from',help='Fixed inclusive UTC start for the review dataset')
p.add_argument('--period-to',help='Fixed inclusive UTC end for the review dataset')
p.add_argument('--output',required=True);p.add_argument('--jmeter',default=str(Path.home()/'.local/bin/jmeter'))
p.add_argument('--allow-shared-read-account',action='store_true')
p.add_argument('--capacity-trial',action='store_true',help='Read-only trial: restart a session after an error so the configured duration is retained')
@@ -58,6 +60,14 @@ def get(path,token=None,body=None):
now=dt.datetime.now(dt.timezone.utc)
period_from=(now-dt.timedelta(days=31)).replace(hour=0,minute=0,second=0,microsecond=0).isoformat().replace('+00:00','Z')
period_to=(now+dt.timedelta(seconds=a.warmup+a.duration+3600)).isoformat().replace('+00:00','Z')
if bool(a.period_from) != bool(a.period_to):p.error('Provide both --period-from and --period-to')
if a.period_from:
try:
fixed_from=dt.datetime.fromisoformat(a.period_from.replace('Z','+00:00'))
fixed_to=dt.datetime.fromisoformat(a.period_to.replace('Z','+00:00'))
if fixed_from.tzinfo is None or fixed_to.tzinfo is None or fixed_to<fixed_from:raise ValueError()
except ValueError:p.error('Fixed period must contain ordered, timezone-aware ISO timestamps')
period_from=a.period_from;period_to=a.period_to
for row in {r['account_id']:r for r in rows}.values():
login=get('/api/authentication/login',body={'accountId':row['account_id'],'password':row['password']});token=login['accessToken']
if a.scenario=='professional':