- Renamed `forum/experiments` to `forum/poc-g1` to designate generation 1. - Created `forum/poc-g2` and a new `lab.ts` runner. - Non-destructively migrated `dag_engine_poc.ts`, `git_storage_poc.ts`, `merkle_diff_poc.ts`, and `frontmatter_poc.ts` to `poc-g2`. - Upgraded migrated PoCs to utilize actual production-ready tools (e.g. `std/yaml` parsing and isolated `Deno.Command` Git repos) per blueprint constraints. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { assertEquals } from "https://deno.land/std@0.224.0/testing/asserts.ts";
|
|
|
|
/**
|
|
* Proof of Concept: Telemetry parsing (OpenTelemetry / Team Friction)
|
|
*
|
|
* Demonstrates the Analyst agent's ability to ingest structured JSON telemetry
|
|
* (like MTTR, PR comment ratios) to optimize workflows.
|
|
*/
|
|
|
|
const mockTeamTelemetry = {
|
|
sprint: "Sprint 42",
|
|
metrics: {
|
|
meanTimeToResolution: 14.5, // hours
|
|
prCommentToCodeRatio: 0.8,
|
|
idleHandoffDuration: 5.2, // hours
|
|
},
|
|
};
|
|
|
|
const mockOpenTelemetryTrace = {
|
|
traceId: "5b8aa5a2d2c8646c14e4d97e6cdbc134",
|
|
spans: [
|
|
{ name: "db_query", duration_ms: 250 },
|
|
{ name: "serialize_json", duration_ms: 12 },
|
|
{ name: "http_request", duration_ms: 300 },
|
|
],
|
|
};
|
|
|
|
function analyzeFriction(telemetry: any): string[] {
|
|
const flags = [];
|
|
if (telemetry.metrics.idleHandoffDuration > 4) {
|
|
flags.push(
|
|
"High idle handoff duration detected. Workflow optimization required.",
|
|
);
|
|
}
|
|
if (telemetry.metrics.prCommentToCodeRatio > 0.5) {
|
|
flags.push(
|
|
"High comment-to-code ratio. Potential ambiguity in requirements.",
|
|
);
|
|
}
|
|
return flags;
|
|
}
|
|
|
|
function findPerformanceBottlenecks(trace: any): string[] {
|
|
return trace.spans
|
|
.filter((span: any) => span.duration_ms > 100)
|
|
.map((span: any) => `Bottleneck in ${span.name}: ${span.duration_ms}ms`);
|
|
}
|
|
|
|
if (import.meta.main) {
|
|
console.log("Running Telemetry Parsing PoC tests...");
|
|
|
|
try {
|
|
const frictionFlags = analyzeFriction(mockTeamTelemetry);
|
|
console.log("Team Friction Analysis:", frictionFlags);
|
|
assertEquals(frictionFlags.length, 2);
|
|
|
|
const bottlenecks = findPerformanceBottlenecks(mockOpenTelemetryTrace);
|
|
console.log("Performance Bottlenecks:", bottlenecks);
|
|
assertEquals(bottlenecks.length, 2);
|
|
|
|
console.log(
|
|
"✅ Telemetry Parsing PoC successful: Flags and bottlenecks identified.",
|
|
);
|
|
} catch (err) {
|
|
console.error("❌ Telemetry Parsing PoC failed:", err);
|
|
Deno.exit(1);
|
|
}
|
|
}
|