github.com/thanos-io/thanos@v0.32.5/pkg/compactv2/changelog.go (about) 1 // Copyright (c) The Thanos Authors. 2 // Licensed under the Apache License 2.0. 3 4 package compactv2 5 6 import ( 7 "fmt" 8 "io" 9 10 "github.com/prometheus/prometheus/model/labels" 11 "github.com/prometheus/prometheus/tsdb/tombstones" 12 ) 13 14 type ChangeLogger interface { 15 DeleteSeries(del labels.Labels, intervals tombstones.Intervals) 16 ModifySeries(old labels.Labels, new labels.Labels) 17 } 18 19 type changeLog struct { 20 w io.Writer 21 } 22 23 func NewChangeLog(w io.Writer) *changeLog { 24 return &changeLog{ 25 w: w, 26 } 27 } 28 29 func (l *changeLog) DeleteSeries(del labels.Labels, intervals tombstones.Intervals) { 30 _, _ = fmt.Fprintf(l.w, "Deleted %v %v\n", del.String(), intervals) 31 } 32 33 func (l *changeLog) ModifySeries(old, new labels.Labels) { 34 _, _ = fmt.Fprintf(l.w, "Relabelled %v %v\n", old.String(), new.String()) 35 }