@@ -139,6 +139,7 @@ const (
139
139
epBuildinfo = apiPrefix + "/status/buildinfo"
140
140
epRuntimeinfo = apiPrefix + "/status/runtimeinfo"
141
141
epTSDB = apiPrefix + "/status/tsdb"
142
+ epWalReplay = apiPrefix + "/status/walreplay"
142
143
)
143
144
144
145
// AlertState models the state of an alert.
@@ -261,6 +262,8 @@ type API interface {
261
262
Metadata (ctx context.Context , metric string , limit string ) (map [string ][]Metadata , error )
262
263
// TSDB returns the cardinality statistics.
263
264
TSDB (ctx context.Context ) (TSDBResult , error )
265
+ // WalReplay returns the current replay status of the wal.
266
+ WalReplay (ctx context.Context ) (WalReplayStatus , error )
264
267
}
265
268
266
269
// AlertsResult contains the result from querying the alerts endpoint.
@@ -437,6 +440,13 @@ type TSDBResult struct {
437
440
SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"`
438
441
}
439
442
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
+
440
450
// Stat models information about statistic value.
441
451
type Stat struct {
442
452
Name string `json:"name"`
@@ -984,6 +994,23 @@ func (h *httpAPI) TSDB(ctx context.Context) (TSDBResult, error) {
984
994
return res , json .Unmarshal (body , & res )
985
995
}
986
996
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
+
987
1014
func (h * httpAPI ) QueryExemplars (ctx context.Context , query string , startTime time.Time , endTime time.Time ) ([]ExemplarQueryResult , error ) {
988
1015
u := h .client .URL (epQueryExemplars , nil )
989
1016
q := u .Query ()
0 commit comments