Skip to Content

Trace

Groups related cost events under a single trace ID. Useful for tracking multi-step agent workflows.

Usage

import { NeuraMeter } from '@neurameter/core'; const meter = new NeuraMeter({ apiKey: 'nm_xxx', projectId: 'proj_xxx', }); const trace = meter.startTrace({ agentName: 'ResearchAgent', customerId: 'cust_456', taskName: 'market-analysis', tags: { department: 'analytics' }, });

TraceOptions

interface TraceOptions { agentName: string; customerId?: string; taskName?: string; tags?: Record<string, string>; }
FieldRequiredDescription
agentNameYesName of the agent
customerIdNoCustomer ID for cost attribution
taskNameNoTask name for grouping
tagsNoArbitrary key-value metadata

How It Works

When you create a trace via meter.startTrace(), a shared traceId is generated. All events recorded through that trace instance share the same traceId, making it easy to query related events in the dashboard.

Each individual event still gets its own unique spanId.

Dashboard

Traces are visible in the dashboard at /dashboard/traces. Click on a trace to see all events within it, including:

  • Total cost across all spans
  • Latency breakdown
  • Token usage per span
  • Model distribution