@@ -139,6 +139,7 @@ const (
139139 epBuildinfo = apiPrefix + "/status/buildinfo"
140140 epRuntimeinfo = apiPrefix + "/status/runtimeinfo"
141141 epTSDB = apiPrefix + "/status/tsdb"
142+ epWalReplay = apiPrefix + "/status/walreplay"
142143)
143144
144145// AlertState models the state of an alert.
@@ -261,6 +262,8 @@ type API interface {
261262 Metadata (ctx context.Context , metric string , limit string ) (map [string ][]Metadata , error )
262263 // TSDB returns the cardinality statistics.
263264 TSDB (ctx context.Context ) (TSDBResult , error )
265+ // WalReplay returns the current replay status of the wal.
266+ WalReplay (ctx context.Context ) (WalReplayStatus , error )
264267}
265268
266269// AlertsResult contains the result from querying the alerts endpoint.
@@ -437,6 +440,13 @@ type TSDBResult struct {
437440 SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"`
438441}
439442
443+ // WalReplayStatus represents the wal replay status.
444+ type WalReplayStatus struct {
445+ Min int `json:"min"`
446+ Max int `json:"max"`
447+ Current int `json:"current"`
448+ }
449+
440450// Stat models information about statistic value.
441451type Stat struct {
442452 Name string `json:"name"`
@@ -984,6 +994,23 @@ func (h *httpAPI) TSDB(ctx context.Context) (TSDBResult, error) {
984994 return res , json .Unmarshal (body , & res )
985995}
986996
997+ func (h * httpAPI ) WalReplay (ctx context.Context ) (WalReplayStatus , error ) {
998+ u := h .client .URL (epWalReplay , nil )
999+
1000+ req , err := http .NewRequest (http .MethodGet , u .String (), nil )
1001+ if err != nil {
1002+ return WalReplayStatus {}, err
1003+ }
1004+
1005+ _ , body , _ , err := h .client .Do (ctx , req )
1006+ if err != nil {
1007+ return WalReplayStatus {}, err
1008+ }
1009+
1010+ var res WalReplayStatus
1011+ return res , json .Unmarshal (body , & res )
1012+ }
1013+
9871014func (h * httpAPI ) QueryExemplars (ctx context.Context , query string , startTime time.Time , endTime time.Time ) ([]ExemplarQueryResult , error ) {
9881015 u := h .client .URL (epQueryExemplars , nil )
9891016 q := u .Query ()
0 commit comments