Documentation
¶
Overview ¶
Package catalogue holds shared helpers for the investor benchmark catalogue artifact: cross-process atomic JSON merge (soak loops) and Pushgateway push.
Index ¶
- func AtomicMergeJSON(path string, merge MergeFunc) error
- func FormatGauge(name string, value float64, labels map[string]string) string
- func FormatPercentileGauges(metricPrefix, runtime string, p50, p90, p99 int64) string
- func MergeEntriesDocument(existing []byte, scenario string, entries []Entry) ([]byte, error)
- func PushSimHeartbeat(simID string) error
- func PushText(job, instance, body string) error
- func PushgatewayURL() string
- func RenderMarkdown(scenario string, doc Document) string
- func SortEntries(entries []Entry)
- type Document
- type Entry
- type MergeFunc
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicMergeJSON ¶
AtomicMergeJSON reads path (if present), applies merge, and writes the result via temp file + rename. A sibling <path>.lock file is flock'd for the duration so concurrent soak-loop passes cannot interleave writes.
func FormatGauge ¶
FormatGauge renders a single Prometheus gauge line (no HELP/TYPE).
func FormatPercentileGauges ¶
FormatPercentileGauges emits p50/p90/p99 gauges for a runtime label.
func MergeEntriesDocument ¶
MergeEntriesDocument merges catalogue entry slices keyed by entry ID.
func PushSimHeartbeat ¶
PushSimHeartbeat fires a best-effort liveness gauge for one sim. It is fire-and-forget: it never blocks the caller and never fails a run — losing a heartbeat is harmless, stalling a run is not. The push runs in the background with a short timeout, and a single failure disables further heartbeats so an unreachable Pushgateway can't spawn a doomed goroutine per remaining sim.
func PushgatewayURL ¶
func PushgatewayURL() string
PushgatewayURL reads AEROL_PUSHGATEWAY_URL. Empty means push is disabled.
func RenderMarkdown ¶
RenderMarkdown builds the investor catalogue report grouped by category.
func SortEntries ¶
func SortEntries(entries []Entry)
SortEntries sorts entries by category, subcategory, id for stable output.
Types ¶
type Document ¶
type Document struct {
Scenario string `json:"scenario"`
GeneratedAt string `json:"generated_at"`
Entries []Entry `json:"entries"`
Summary Summary `json:"summary"`
Machine map[string]any `json:"machine,omitempty"`
}
Document is the on-disk catalogue JSON shape.
type Entry ¶
type Entry struct {
ID string `json:"id"`
Question string `json:"question"`
Category string `json:"category"`
Subcategory string `json:"subcategory,omitempty"`
Runtime string `json:"runtime,omitempty"`
Scenario string `json:"scenario"`
LatencyMS int64 `json:"latency_ms,omitempty"`
Success bool `json:"success"`
Skipped bool `json:"skipped,omitempty"`
PublicURL string `json:"public_url,omitempty"`
Artifact string `json:"artifact,omitempty"`
Notes string `json:"notes,omitempty"`
SimID string `json:"sim_id,omitempty"`
}
Entry is one executed catalogue question recorded into the JSON artifact.
type MergeFunc ¶
MergeFunc receives the existing JSON bytes (nil/empty on first write) and returns the merged document to persist.