Watcher watches the TSDB WAL for a given WriteTo.
| 88 | |
| 89 | // Watcher watches the TSDB WAL for a given WriteTo. |
| 90 | type Watcher struct { |
| 91 | name string |
| 92 | writer WriteTo |
| 93 | recordBuf *record.BuffersPool |
| 94 | logger *slog.Logger |
| 95 | walDir string |
| 96 | lastCheckpoint string |
| 97 | sendExemplars bool |
| 98 | sendHistograms bool |
| 99 | sendMetadata bool |
| 100 | metrics *WatcherMetrics |
| 101 | readerMetrics *LiveReaderMetrics |
| 102 | |
| 103 | startTime time.Time |
| 104 | startTimestamp int64 // the start time as a Prometheus timestamp |
| 105 | sendSamples bool |
| 106 | |
| 107 | recordsReadMetric *prometheus.CounterVec |
| 108 | recordDecodeFailsMetric prometheus.Counter |
| 109 | samplesSentPreTailing prometheus.Counter |
| 110 | currentSegmentMetric prometheus.Gauge |
| 111 | notificationsSkipped prometheus.Counter |
| 112 | |
| 113 | readNotify chan struct{} |
| 114 | quit chan struct{} |
| 115 | done chan struct{} |
| 116 | |
| 117 | // For testing, stop when we hit this segment. |
| 118 | MaxSegment int |
| 119 | } |
| 120 | |
| 121 | func NewWatcherMetrics(reg prometheus.Registerer) *WatcherMetrics { |
| 122 | m := &WatcherMetrics{ |
nothing calls this directly
no outgoing calls
no test coverage detected