Files
bdinvite/experiments/bdinvite-sso-graphify-benchmark/evaluator/telemetry.py
T
kiskaadee 99f8581cc8 docs(experiments): archive bdinvite SSO Graphify benchmark
Archive the frozen benchmark artifacts, evaluation tooling, disposable
OIDC fixture, and raw checkpoint telemetry comparing control and
Graphify agent runs for SSO authentication in BDInvite.

- Add retrospective README detailing outcomes, token estimation
  limitations, artifact map, and host environment notes
- Preserve frozen specification (sha256 verified) and manifest
- Archive evaluation runner, static checks, and telemetry scripts
- Retain disposable mock OAuth2 fixture and 16 checkpoint result records
- Link the archived experiment from the root repository README
2026-10-07 06:01:42 -05:00

47 lines
1.4 KiB
Python

"""Telemetry logging utility for BDInvite SSO Benchmark."""
import json
from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Dict, Optional
def log_checkpoint_telemetry(
results_dir: Path,
agent: str,
checkpoint: str,
started_at: datetime,
ended_at: datetime,
status: str,
outcome_reason: str = "none",
verification_data: Optional[Dict[str, Any]] = None,
git_data: Optional[Dict[str, Any]] = None,
tool_calls: Optional[Dict[str, Any]] = None,
tokens: Optional[Dict[str, Any]] = None,
rework_iterations: int = 0,
) -> Path:
"""Record structured telemetry for a completed checkpoint evaluation."""
agent_dir = results_dir / agent
agent_dir.mkdir(parents=True, exist_ok=True)
out_file = agent_dir / f"{checkpoint}.json"
duration_wall_clock = int((ended_at - started_at).total_seconds())
record = {
"agent": agent,
"checkpoint": checkpoint,
"started_at": started_at.isoformat(),
"ended_at": ended_at.isoformat(),
"duration_wall_clock_seconds": duration_wall_clock,
"rework_iterations": rework_iterations,
"status": status,
"outcome_reason": outcome_reason,
"verification": verification_data or {},
"git": git_data or {},
"tool_calls": tool_calls or {},
"tokens": tokens or {},
}
out_file.write_text(json.dumps(record, indent=2), encoding="utf-8")
return out_file