Documentation
¶
Overview ¶
Package gnomon is a tiny, standardized BI layer: register business metrics (live ReadThrough or daily Snapshot), then capture and serve them. It owns no scheduling and no auth — the host wires Capture into its own job runner and wraps adminhttp with its own auth middleware.
Index ¶
- type Chart
- type DataSource
- type Gnomon
- func (g *Gnomon) Capture(ctx context.Context, on time.Time) error
- func (g *Gnomon) Metrics() []Metric
- func (g *Gnomon) Query(ctx context.Context, name string) ([]Row, error)
- func (g *Gnomon) Register(ms ...Metric) error
- func (g *Gnomon) Series(ctx context.Context, name string, from, to time.Time) ([]Point, error)
- type Kind
- type Metric
- type Point
- type Row
- type Sample
- type Store
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataSource ¶
DataSource runs metric SQL against the host's data database.
type Gnomon ¶
type Gnomon struct {
// contains filtered or unexported fields
}
Gnomon is the engine: a metric registry over a DataSource + Store.
func New ¶
func New(data DataSource, store Store) *Gnomon
func (*Gnomon) Capture ¶
Capture runs every registered Snapshot metric's SQL, parses the rows into samples, and upserts them stamped with `on`. ReadThrough metrics are skipped. One metric's failure does not abort the rest; all errors are joined.
func (*Gnomon) Query ¶
Query runs a ReadThrough metric and returns its rows. It errors if the metric is unknown or is not a ReadThrough metric.
type Metric ¶
Metric is a single registered metric. For Snapshot kind, SQL must return a `value` column and may return a `dimension` column. For ReadThrough kind, SQL may return arbitrary columns.
type Point ¶
type Point struct {
CapturedOn time.Time `json:"captured_on"`
Dimension string `json:"dimension"`
Value float64 `json:"value"`
}
Point is one stored snapshot data point read back from the store.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package adminhttp exposes a mountable, auth-agnostic JSON handler for serving gnomon metric metadata, live ReadThrough results, and stored Snapshot series.
|
Package adminhttp exposes a mountable, auth-agnostic JSON handler for serving gnomon metric metadata, live ReadThrough results, and stored Snapshot series. |
|
Package sourcepg provides a Postgres-backed gnomon.DataSource + gnomon.Store over a gnomon_snapshots table.
|
Package sourcepg provides a Postgres-backed gnomon.DataSource + gnomon.Store over a gnomon_snapshots table. |