mirror of
https://github.com/grafana/grafana.git
synced 2024-11-21 16:38:03 -06:00
Annotations: Make the annotation clean up batch size configurable (#31487)
Signed-off-by: bergquist <carl.bergquist@gmail.com> Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
This commit is contained in:
parent
445132a904
commit
3b36636318
@ -682,6 +682,9 @@ max_annotation_age =
|
||||
max_annotations_to_keep =
|
||||
|
||||
#################################### Annotations #########################
|
||||
[annotations]
|
||||
# Configures the batch size for the annotation clean-up job. This setting is used for dashboard, API, and alert annotations.
|
||||
cleanupjob_batchsize = 100
|
||||
|
||||
[annotations.dashboard]
|
||||
# Dashboard annotations means that annotations are associated with the dashboard they are created on.
|
||||
|
@ -675,6 +675,9 @@
|
||||
;max_annotations_to_keep =
|
||||
|
||||
#################################### Annotations #########################
|
||||
[annotations]
|
||||
# Configures the batch size for the annotation clean-up job. This setting is used for dashboard, API, and alert annotations.
|
||||
;cleanupjob_batchsize = 100
|
||||
|
||||
[annotations.dashboard]
|
||||
# Dashboard annotations means that annotations are associated with the dashboard they are created on.
|
||||
|
@ -1082,6 +1082,12 @@ Configures max number of alert annotations that Grafana stores. Default value is
|
||||
|
||||
<hr>
|
||||
|
||||
## [annotations]
|
||||
|
||||
### cleanupjob_batchsize
|
||||
|
||||
Configures the batch size for the annotation clean-up job. This setting is used for dashboard, API, and alert annotations.
|
||||
|
||||
## [annotations.dashboard]
|
||||
|
||||
Dashboard annotations means that annotations are associated with the dashboard they are created on.
|
||||
|
@ -105,7 +105,7 @@ func (ss *SQLStore) Init() error {
|
||||
|
||||
// Init repo instances
|
||||
annotations.SetRepository(&SQLAnnotationRepo{})
|
||||
annotations.SetAnnotationCleaner(&AnnotationCleanupService{batchSize: 100, log: log.New("annotationcleaner")})
|
||||
annotations.SetAnnotationCleaner(&AnnotationCleanupService{batchSize: ss.Cfg.AnnotationCleanupJobBatchSize, log: log.New("annotationcleaner")})
|
||||
ss.Bus.SetTransactionManager(ss)
|
||||
|
||||
// Register handlers
|
||||
|
@ -317,6 +317,7 @@ type Cfg struct {
|
||||
HiddenUsers map[string]struct{}
|
||||
|
||||
// Annotations
|
||||
AnnotationCleanupJobBatchSize int64
|
||||
AlertingAnnotationCleanupSetting AnnotationCleanupSettings
|
||||
DashboardAnnotationCleanupSettings AnnotationCleanupSettings
|
||||
APIAnnotationCleanupSettings AnnotationCleanupSettings
|
||||
@ -473,6 +474,9 @@ func (cfg *Cfg) readGrafanaEnvironmentMetrics() error {
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readAnnotationSettings() {
|
||||
section := cfg.Raw.Section("annotations")
|
||||
cfg.AnnotationCleanupJobBatchSize = section.Key("cleanupjob_batchsize").MustInt64(100)
|
||||
|
||||
dashboardAnnotation := cfg.Raw.Section("annotations.dashboard")
|
||||
apiIAnnotation := cfg.Raw.Section("annotations.api")
|
||||
alertingSection := cfg.Raw.Section("alerting")
|
||||
|
Loading…
Reference in New Issue
Block a user