Documentation
¶
Overview ¶
Package auditapi serves the /api/v1/admin/audit surface: the raw event list, its filter vocabulary and single-event lookup, and the aggregate metrics behind the admin dashboard. It is a decomposition seam of pkg/admin (which sat at the package size budget); the parent registers it on the admin mux.
The two stores are separate because they are separately optional: a deployment can serve the event list without the aggregate rollups, and the parent keeps its own 409 fallback for the case where audit is enabled in config but no database backs it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Events reads raw audit events. nil leaves the event routes off, which
// is the parent's cue to mount its feature-unavailable fallback.
Events EventQuerier
// Metrics reads the aggregate rollups. nil leaves the metrics routes
// off.
Metrics MetricsQuerier
}
Config carries the stores these routes need. Both are independently optional; a nil store simply leaves its routes unregistered.
type EventQuerier ¶
type EventQuerier interface {
Query(ctx context.Context, filter audit.QueryFilter) ([]audit.Event, error)
Count(ctx context.Context, filter audit.QueryFilter) (int, error)
Distinct(ctx context.Context, column string, startTime, endTime *time.Time) ([]string, error)
DistinctPairs(ctx context.Context, col1, col2 string, startTime, endTime *time.Time) (map[string]string, error)
}
EventQuerier reads raw audit events and their filter vocabulary.
type MetricsQuerier ¶
type MetricsQuerier interface {
Timeseries(ctx context.Context, filter audit.TimeseriesFilter) ([]audit.TimeseriesBucket, error)
Breakdown(ctx context.Context, filter audit.BreakdownFilter) ([]audit.BreakdownEntry, error)
Overview(ctx context.Context, filter audit.MetricsFilter) (*audit.Overview, error)
Performance(ctx context.Context, filter audit.MetricsFilter) (*audit.PerformanceStats, error)
Enrichment(ctx context.Context, filter audit.MetricsFilter) (*audit.EnrichmentStats, error)
Discovery(ctx context.Context, filter audit.MetricsFilter) (*audit.DiscoveryStats, error)
}
MetricsQuerier provides the aggregate audit rollups.