Repository navigation
ConvertTo‑ShpOtelTrace
Translates a ShellPilot Event stream into OpenTelemetry-compatible spans, without taking an OpenTelemetry dependency.
ConvertTo-ShpOtelTrace [-Path] <String> [-MappingVersion <String>] [-IncludeContent] [-ServiceName <String>]
[-Format <String>] [<CommonParameters>]
ConvertTo-ShpOtelTrace -InputObject <Object[]> [-MappingVersion <String>] [-IncludeContent]
[-ServiceName <String>] [-Format <String>] [<CommonParameters>]
Reads the headless JSONL Event stream (Invoke-Shp -EventStream) and returns the same run expressed as spans: one per Turn, model request, Tool call, policy decision, MCP request and Subagent, carrying usage, cost, finish and error facts as attributes.
It is a TRANSLATION, not an exporter. Nothing here opens a socket, starts a background process or links an SDK: the module stays pure PowerShell with no runtime dependency, and shipping the result to a collector is the caller's step - -Format Otlp produces the resourceSpans document an OTLP/HTTP endpoint accepts, and the caller posts it with whatever they already trust.
Span identity is not invented here. Every record carries the trace, span and parent identity stamped when it was written, so the tree is rebuilt from the file alone and a Batch, Job or Subagent record lands under the parent that dispatched it. A record with no trace identity - a stream written before spec 042 - is dropped and counted rather than given a synthetic trace, because a fabricated tree is harder to notice than a missing one.
CONTENT IS OFF BY DEFAULT. Prompts, answers, Tool arguments, Tool result previews, reasoning traces and error messages are withheld; only their measurable shape (lengths, counts, decisions, identities) is exported. -IncludeContent opts in, and what it includes is passed through the module's existing redaction seam first, so a custom Set-ShpRedactionPolicy rule covers an export too.
The MAPPING VERSION IS DEVELOPMENTAL and says so on every report. The semantic conventions for generative-AI and agent telemetry are still moving, so attribute names here may change; state -MappingVersion to assert the one you built against and get an error rather than a silent re-shape.
Span names are deliberately low cardinality - no path, URL or identifier is ever part of a name - so a backend can aggregate them.
ConvertTo-ShpOtelTrace -Path ./run.jsonl
Returns the run as spans, with no prompt, answer or Tool content.
ConvertTo-ShpOtelTrace -Path ./run.jsonl -Format Otlp -ServiceName 'ci-agent' |
ConvertTo-Json -Depth 12 | Set-Content ./otlp.json
Produces the document an OTLP/HTTP collector accepts.
'Span' (default) returns ShellPilot.OtelSpan objects on a report object; 'Otlp' returns the OTLP/JSON resourceSpans document.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Span
Accept pipeline input: False
Accept wildcard characters: FalseInclude prompt, answer, argument, result-preview, reasoning and error message text, after redaction. Off by default.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAlready-parsed event records, by pipeline or by value, instead of a file.
Type: Object[]
Parameter Sets: InputObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseThe mapping version this caller was written against. Refused when it is not one this module implements.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe Event stream file to translate. One JSON object per line.
Type: String
Parameter Sets: Path
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe service.name resource attribute of an -Format Otlp document.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- Clear-ShpChat
- Clear-ShpContext
- Clear-ShpRedactionPolicy
- Clear-ShpToolPolicy
- Clear-ShpUsage
- Compress-ShpChat
- ConvertTo-ShpAnnotation
- ConvertTo-ShpOtelTrace
- ConvertTo-ShpTokenCount
- Get-ShpChat
- Get-ShpChatCheckpoint
- Get-ShpContext
- Get-ShpContextReport
- Get-ShpCosineSimilarity
- Get-ShpCostEstimate
- Get-ShpDefault
- Get-ShpMcpServer
- Get-ShpModel
- Get-ShpModelName
- Get-ShpRedactionPolicy
- Get-ShpTool
- Get-ShpToolPolicy
- Get-ShpUsage
- Initialize-Shp
- Invoke-Shp
- Invoke-ShpBatch
- Invoke-ShpEval
- Invoke-ShpSubagent
- Register-ShpMcpServer
- Register-ShpTool
- Request-ShpEmbedding
- Resolve-ShpError
- Restore-ShpChat
- Save-ShpChat
- Select-ShpModel
- Set-ShpContext
- Set-ShpRedactionPolicy
- Set-ShpToolPolicy
- Start-ShpChat
- Test-ShpCiReadiness
- Unregister-ShpMcpServer
- Unregister-ShpTool