Duration returns the configured duration or the default duration if no value is configured or the configured value is invalid.
()
| 688 | // Duration returns the configured duration or the default duration if no value |
| 689 | // is configured or the configured value is invalid. |
| 690 | func (m *Metrics) Duration() time.Duration { |
| 691 | duration, err := m.ParseDuration() |
| 692 | if err != nil { |
| 693 | slog.With(slog.Any("error", err)).Error(fmt.Sprintf("defined duration %s is invalid", m.Period)) |
| 694 | } |
| 695 | if duration == 0 { |
| 696 | slog.Debug(fmt.Sprintf("using default duration %s for metrics update interval", appdefaults.DefaultMetricsUpdateInterval)) |
| 697 | return appdefaults.DefaultMetricsUpdateInterval |
| 698 | } |
| 699 | return duration |
| 700 | } |
| 701 | |
| 702 | // WebUI holds configuration for the web UI |
| 703 | type WebUI struct { |