Skip to content

Commit f1c0737

Browse files
sklinglernvclaude
andauthored
feat(viewer): qualify method spans with the owning agent class (#113)
Method spans are named `method.<name>` only, so concurrent agents that share a method name are indistinguishable in the trace tree: a `Rationalizer.analyse()` and a `Verifier.analyse()` both render as `analyse`. The class is already on the span as `agent.name` (set in _hooks_impl.py for both `method.*` and `method_call.*`), but the viewer only surfaced it in the metadata block of a fully expanded span. Show it in the badge instead, as a dimmer prefix so the method stays the primary token. Rendering-only: no change to span names or attributes, so existing traces show the class immediately without re-running anything. Falls back to the bare method name when `agent.name` is absent, leaving old traces as they were. Signed-off-by: Severin Klingler <sklingler@nvidia.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 6ffbf60 commit f1c0737

3 files changed

Lines changed: 42 additions & 18 deletions

File tree

src/nooa/viewer/frontend-react/dist/assets/index-E_NaY3T0.js renamed to src/nooa/viewer/frontend-react/dist/assets/index-Bji-l1q1.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/nooa/viewer/frontend-react/dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>NVIDIA OO Agents Viewer</title>
7-
<script type="module" crossorigin src="/assets/index-E_NaY3T0.js"></script>
7+
<script type="module" crossorigin src="/assets/index-Bji-l1q1.js"></script>
88
<link rel="stylesheet" crossorigin href="/assets/index-Css9Iyl2.css">
99
</head>
1010
<body>

src/nooa/viewer/frontend-react/src/components/plugins/MethodPlugin.tsx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,34 @@ function buildCallString(attrs: Record<string, unknown>, truncate = true): strin
9191
return `${method}(${argParts.join(', ')})`;
9292
}
9393

94+
/**
95+
* Method badge, qualified with the owning agent class when known.
96+
*
97+
* Span names carry only the method (`method.analyse`), so two agents with the
98+
* same method name are indistinguishable in the tree. The class is on the span
99+
* as `agent.name` — render it as a dimmer prefix so `Rationalizer.analyse` and
100+
* `Verifier.analyse` are tellable apart at a glance.
101+
*/
102+
function MethodBadge({
103+
agentName,
104+
method,
105+
className = '',
106+
}: {
107+
agentName: string;
108+
method: string;
109+
className?: string;
110+
}) {
111+
return (
112+
<span
113+
className={`px-1.5 py-0.5 rounded bg-purple-900 text-purple-200 text-xs font-semibold ${className}`}
114+
title={agentName ? `${agentName}.${method}` : method}
115+
>
116+
{agentName && <span className="text-purple-400 font-normal">{agentName}.</span>}
117+
{method}
118+
</span>
119+
);
120+
}
121+
94122
function ExpandedMetadata({
95123
attrs,
96124
agentName,
@@ -156,9 +184,7 @@ export function MethodPlugin({ event, viewState, rawJsonOpen, viewControls }: Pl
156184
return (
157185
<div className="flex items-center justify-between text-sm">
158186
<div className="flex-1 min-w-0 text-gray-300 font-mono truncate">
159-
<span className="px-1.5 py-0.5 rounded bg-purple-900 text-purple-200 text-xs font-semibold mr-1">
160-
{method}
161-
</span>
187+
<MethodBadge agentName={agentName} method={method} className="mr-1" />
162188
{summary}
163189
{durationNs > 0 && (
164190
<span className="text-gray-500 ml-2">({formatDuration(durationNs)})</span>
@@ -191,9 +217,7 @@ export function MethodPlugin({ event, viewState, rawJsonOpen, viewControls }: Pl
191217
return (
192218
<div>
193219
<div className="flex items-center gap-3 text-xs text-gray-400 mb-2">
194-
<span className="px-1.5 py-0.5 rounded bg-purple-900 text-purple-200 text-xs font-semibold">
195-
{method}
196-
</span>
220+
<MethodBadge agentName={agentName} method={method} />
197221
{durationNs > 0 && <span>{formatDuration(durationNs)}</span>}
198222
{hasError && <span className="text-red-400">Error</span>}
199223
<span className="ml-auto opacity-60">{timestamp}</span>

0 commit comments

Comments
 (0)