Documentation
¶
Overview ¶
Package report turns silk's persisted tag history into FameView-style 报表 (interval reports): it slices a time range into fixed buckets, reduces each tag's samples in every bucket with a chosen aggregate, and renders the grid as CSV or HTML. A screen operator picks tags, a window, an interval and an aggregate; Build fills the table one Query per tag per bucket.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate int
Aggregate names the reducer applied to the samples inside one bucket.
type Bucket ¶
Bucket is one report row: a half-open time slice [From, To) and, per tag, the aggregated value of that tag's samples in the slice. A tag with no samples in the bucket is absent from Values (renders as an empty cell), never stored as NaN.
type Report ¶
Report is the finished grid: the ordered tag columns and the ordered buckets.
func Build ¶
func Build(h *historian.Historian, tags []string, from, to time.Time, interval time.Duration, a Aggregate) (*Report, error)
Build aggregates history for tags over [from, to), one bucket per interval. For each bucket it Queries each tag's samples in the half-open slice, reduces them with a, and stores the result under Values[tag]; a bucket with no samples for a tag omits that tag (empty cell). The final bucket is clamped so the report covers exactly [from, to). interval must be positive.