Stats: range buttons follow the retention settings
The Statistics page offers only the ranges kept (longest of the minute, hour and day retentions), adds 1y and 2y when the daily data covers them, caps the heatmap at the hourly retention and links to Explore within retention.queries. Status and explore send retention_seconds. The query log error names stats.retention.queries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f3564c0a5
commit
1d535c8063
8 files changed
+81
-32
No files matched your search
@@ -95,6 +95,13 @@ type Status struct {
|
||||
Day string `json:"day"`
|
||||
Queries string `json:"queries"` // the query log ("" when off)
|
||||
} `json:"retention"`
|
||||
// RetentionSeconds is Retention in seconds, for the web UI's ranges.
|
||||
RetentionSeconds struct {
|
||||
Minute int64 `json:"minute"`
|
||||
Hour int64 `json:"hour"`
|
||||
Day int64 `json:"day"`
|
||||
Queries int64 `json:"queries"` // 0 when the query log is off
|
||||
} `json:"retention_seconds"`
|
||||
}
|
||||
|
||||
// Collector gathers statistics into a Store.
|
||||
@@ -164,8 +171,12 @@ func NewCollector(store *Store, opts Options, zones ZoneIndex, log *slog.Logger)
|
||||
c.status.Retention.Minute = humanDuration(opts.RetainMinute)
|
||||
c.status.Retention.Hour = humanDuration(opts.RetainHour)
|
||||
c.status.Retention.Day = humanDuration(opts.RetainDay)
|
||||
c.status.RetentionSeconds.Minute = int64(opts.RetainMinute / time.Second)
|
||||
c.status.RetentionSeconds.Hour = int64(opts.RetainHour / time.Second)
|
||||
c.status.RetentionSeconds.Day = int64(opts.RetainDay / time.Second)
|
||||
if opts.QueryLog && opts.RetainQueries > 0 {
|
||||
c.status.Retention.Queries = humanDuration(opts.RetainQueries)
|
||||
c.status.RetentionSeconds.Queries = int64(opts.RetainQueries / time.Second)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user