Documentation
¶
Overview ¶
Package telemetry contains the local, sanitized measurement stream.
The public event constructor intentionally accepts only typed closed values. Prompts, diffs, outputs, paths, and free text have no field in this package.
Index ¶
- Constants
- func EmitBestEffort(event Event)
- func EmitBestEffortInput(input EventInput)
- func FormatFullStats(stats Stats) string
- func FormatStats(stats Stats) string
- func GateVerdictRank(verdict string) int
- func NewTraceID() string
- func ProjectID(root string) string
- func TelemetryEnabled() bool
- type Event
- func DecodeEvent(encoded []byte) (Event, error)
- func FilterProject(events []Event, projectID string) []Event
- func NewEvent(input EventInput) (Event, error)
- func NewFullEvent(input EventInput) (Event, error)
- func NewToolCallEvent(projectID, traceID, tool, status string, durationMs int64) (Event, error)
- type EventInput
- type GitHistory
- type ModuleStats
- type Stats
- type Store
Constants ¶
const ( CurrentSchemaVersion = "2" NoData = "no-data" LevelUser = "user" LevelFull = "full" EventToolCall = "tool_call" EventVerify = "verify" EventApply = "apply" EventDiscard = "discard" EventRemediation = "remediation" EventEscalation = "escalation" EventFlowNode = "flow_node" EventGateDecision = "gate.decision" EventVerifyDenial = "verify.denial" EventReviewDisagreement = "review.disagreement" EventCleanExitClose = "cleanexit.close" EventPreflightCheck = "preflight.check" EventMissionInterruption = "mission.interruption" )
const ( MetricFirstPassVerify = "verify_first_pass_pct" MetricRemediation = "remediation_iterations_per_mission" MetricEscalation = "escalation_pct" MetricAutoApply = "auto_apply_without_intervention_pct" MetricMissionApplyP50 = "mission_to_apply_p50_ms" MetricMissionApplyP95 = "mission_to_apply_p95_ms" MetricMissionsPerDay = "missions_per_day" MetricRevertedApplyPct = "apply_reverted_pct_heuristic" MetricMissionBytesIn = "mission_bytes_in" MetricMissionBytesOut = "mission_bytes_out" MetricMissionInterruptions = "mission_interruptions" MetricCleanExitResult = "clean_exit_result" )
Variables ¶
This section is empty.
Functions ¶
func EmitBestEffort ¶
func EmitBestEffort(event Event)
func EmitBestEffortInput ¶
func EmitBestEffortInput(input EventInput)
func FormatFullStats ¶
func FormatStats ¶
func GateVerdictRank ¶
func NewTraceID ¶
func NewTraceID() string
func ProjectID ¶
ProjectID derives the stable local identity used by the rest of JACU. A registration path cannot return an error without changing the MCP startup contract, so an invalid root becomes a bounded sentinel and telemetry is still isolated from the governed result.
func TelemetryEnabled ¶
func TelemetryEnabled() bool
Types ¶
type Event ¶
type Event struct {
SchemaVersion string `json:"schema_version"`
Timestamp time.Time `json:"ts"`
Level string `json:"level"`
ProjectID string `json:"project_id"`
TraceID string `json:"trace_id"`
RunID string `json:"run_id,omitempty"`
MissionID string `json:"mission_id,omitempty"`
ProgramID string `json:"program_id,omitempty"`
Module string `json:"module"`
Stage string `json:"stage"`
Event string `json:"event"`
Tool string `json:"tool,omitempty"`
Status string `json:"status"`
DurationMs int64 `json:"duration_ms,omitempty"`
Measurement string `json:"measurement,omitempty"`
InputBytes int64 `json:"input_bytes,omitempty"`
OutputBytes int64 `json:"output_bytes,omitempty"`
Capped bool `json:"capped,omitempty"`
DegradedPartial bool `json:"degraded_partial,omitempty"`
Ceremony string `json:"ceremony,omitempty"`
Risk string `json:"risk,omitempty"`
Verdict string `json:"verdict,omitempty"`
Iteration int `json:"iteration,omitempty"`
ExitReason string `json:"exit_reason,omitempty"`
Reason string `json:"reason,omitempty"`
ProgramKnown bool `json:"program_known"`
Auto bool `json:"auto,omitempty"`
Intervention bool `json:"intervention,omitempty"`
DiffBytes int64 `json:"diff_bytes,omitempty"`
FilesChanged int `json:"files_changed,omitempty"`
Resolved string `json:"resolved,omitempty"`
Result string `json:"result,omitempty"`
FailureClass string `json:"failure_class,omitempty"`
}
Event is the only record written to the local stream. Keep this struct closed: adding a field is a telemetry contract change and needs a test.
func DecodeEvent ¶
func FilterProject ¶
FilterProject keeps the shared local store from mixing independent repositories in one project's diagnosis.
func NewEvent ¶
func NewEvent(input EventInput) (Event, error)
func NewFullEvent ¶
func NewFullEvent(input EventInput) (Event, error)
NewFullEvent exposes the same closed typed surface at the owner's detail level. It deliberately reuses EventInput: there is no full-level escape hatch for prompts, diffs, outputs, paths, or free text.
func NewToolCallEvent ¶
type EventInput ¶
type EventInput struct {
SchemaVersion string
Timestamp time.Time
Level string
ProjectID string
TraceID string
RunID string
MissionID string
ProgramID string
Module string
Stage string
Event string
Tool string
Status string
Duration time.Duration
Measurement string
InputBytes int64
OutputBytes int64
Capped bool
DegradedPartial bool
Ceremony string
Risk string
Verdict string
Iteration int
ExitReason string
Reason string
ProgramKnown bool
Auto bool
Intervention bool
DiffBytes int64
FilesChanged int
Resolved string
Result string
FailureClass string
}
EventInput uses a duration instead of an unbounded free-form duration string. Every field maps to an allowlisted Event field.
type GitHistory ¶
type GitHistory struct{ Repo string }
type ModuleStats ¶
type Stats ¶
type Stats struct {
Since time.Time
Until time.Time
FirstPassVerifyPct float64
RemediationIterations float64
EscalationPct float64
AutoApplyPct float64
MissionApplyP50Ms int64
MissionApplyP95Ms int64
MissionsPerDay float64
ToolP95Ms map[string]int64
RevertedApplyPct float64
RevertHeuristic bool
Available map[string]bool
Modules map[string]ModuleStats
MissionBytesIn int64
MissionBytesOut int64
}
func ComputeStats ¶
func ReportStats ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStoreAt ¶
func NewStoreAtWithLimits ¶
NewStoreAtWithLimits is intended for deterministic package tests. Production constructors retain the fixed 8MiB/128MiB/12-month policy.