Documentation
¶
Index ¶
Constants ¶
View Source
const ( DAY_LAYOUT = "2006-01-02" TABLE_DAILY_SUMS = "daily_app_sums" )
TODO: db package needs some form of unit testing
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfluxDBOptions ¶
type PostgresClient ¶
func NewPostgresClient ¶
func NewPostgresClient(options PostgresOptions) (PostgresClient, error)
type PostgresOptions ¶
type Reporter ¶
type Reporter interface {
// DailyUsage returns saved daily metrics for the specified time period, with each day being an entry in the results map
DailyUsage(from, to time.Time) (map[time.Time]map[string]api.RelayCounts, error)
// TodaysUsage returns the metrics for today so far
TodaysUsage() (map[string]api.RelayCounts, error)
}
Will be implemented by Postgres DB interface
type Source ¶
type Source interface {
AppRelays(from, to time.Time) (map[string]api.RelayCounts, error)
DailyCounts(from, to time.Time) (map[time.Time]map[string]api.RelayCounts, error)
// Returns application metrics for today so far
TodaysCounts() (map[string]api.RelayCounts, error)
}
func NewInfluxDBSource ¶
func NewInfluxDBSource(options InfluxDBOptions) Source
type Writer ¶
type Writer interface {
// TODO: rollover of entries
WriteDailyUsage(counts map[time.Time]map[string]api.RelayCounts) error
// WriteTodaysUsage writes todays relay counts to the underlying storage.
WriteTodaysUsage(counts map[string]api.RelayCounts) error
// Returns oldest and most recent timestamps for stored metrics
ExistingMetricsTimespan() (time.Time, time.Time, error)
}
Will be implemented by Postgres DB interface
Click to show internal directories.
Click to hide internal directories.