@@ -689,22 +689,31 @@ func (s *server) handleStatus(w http.ResponseWriter, r *http.Request) {
689689 return
690690 }
691691
692- res .EventsProcessed = status .Repl .EventsProcessed
693- res .LagTime = status .TotalLagTime
692+ res .EventsRead = status .Repl .EventsRead
693+ res .EventsApplied = status .Repl .EventsApplied
694+ res .LagTimeSeconds = status .TotalLagTimeSeconds
694695
695696 if ! status .Repl .LastReplicatedOpTime .IsZero () {
696- res . LastReplicatedOpTime = fmt .Sprintf ("%d.%d" ,
697+ ts : = fmt .Sprintf ("%d.%d" ,
697698 status .Repl .LastReplicatedOpTime .T ,
698699 status .Repl .LastReplicatedOpTime .I )
700+
701+ isoDate := time .Unix (int64 (status .Repl .LastReplicatedOpTime .T ),
702+ int64 (status .Repl .LastReplicatedOpTime .I )).UTC ()
703+
704+ res .LastReplicatedOpTime = & lastReplicatedOpTime {
705+ TS : ts ,
706+ ISODate : isoDate .Format (time .RFC3339 ),
707+ }
699708 }
700709
701710 res .InitialSync = & statusInitialSyncResponse {
702- Completed : status .InitialSyncCompleted ,
703- LagTime : status .InitialSyncLagTime ,
711+ Completed : status .InitialSyncCompleted ,
712+ LagTimeSeconds : status .InitialSyncLagTimeSeconds ,
704713
705- CloneCompleted : status .Clone .IsFinished (),
706- EstimatedCloneSize : status .Clone .EstimatedTotalSize ,
707- ClonedSize : status .Clone .CopiedSize ,
714+ CloneCompleted : status .Clone .IsFinished (),
715+ EstimatedCloneSizeBytes : status .Clone .EstimatedTotalSizeBytes ,
716+ ClonedSizeBytes : status .Clone .CopiedSizeBytes ,
708717 }
709718
710719 switch {
@@ -992,26 +1001,33 @@ type statusResponse struct {
9921001 // Info provides additional information about the current state.
9931002 Info string `json:"info,omitempty"`
9941003
995- // LagTime is the current lag time in logical seconds.
996- LagTime int64 `json:"lagTime"`
997- // EventsProcessed is the number of events processed.
998- EventsProcessed int64 `json:"eventsProcessed"`
1004+ // LagTimeSeconds is the current lag time in logical seconds.
1005+ LagTimeSeconds int64 `json:"lagTimeSeconds"`
1006+ // EventsRead is the number of events read from the source. Not counting tick events.
1007+ EventsRead int64 `json:"eventsRead"`
1008+ // EventsApplied is the number of events applied.
1009+ EventsApplied int64 `json:"eventsApplied"`
9991010 // LastReplicatedOpTime is the last replicated operation time.
1000- LastReplicatedOpTime string `json:"lastReplicatedOpTime,omitempty"`
1011+ LastReplicatedOpTime * lastReplicatedOpTime `json:"lastReplicatedOpTime,omitempty"`
10011012
10021013 // InitialSync contains the initial sync status details.
10031014 InitialSync * statusInitialSyncResponse `json:"initialSync,omitempty"`
10041015}
10051016
1017+ type lastReplicatedOpTime struct {
1018+ TS string `json:"ts"`
1019+ ISODate string `json:"isoDate"`
1020+ }
1021+
10061022// statusInitialSyncResponse represents the initial sync status in the /status response.
10071023type statusInitialSyncResponse struct {
1008- // LagTime is the lag time in logical seconds until the initial sync completed.
1009- LagTime int64 `json:"lagTime ,omitempty"`
1024+ // LagTimeSeconds is the lag time in logical seconds until the initial sync completed.
1025+ LagTimeSeconds int64 `json:"lagTimeSeconds ,omitempty"`
10101026
1011- // EstimatedCloneSize is the estimated total size of the clone.
1012- EstimatedCloneSize uint64 `json:"estimatedCloneSize ,omitempty"`
1013- // ClonedSize is the size of the data that has been cloned.
1014- ClonedSize uint64 `json:"clonedSize "`
1027+ // EstimatedCloneSizeBytes is the estimated total size of the clone in bytes .
1028+ EstimatedCloneSizeBytes uint64 `json:"estimatedCloneSizeBytes ,omitempty"`
1029+ // ClonedSizeBytes is the size of the data that has been cloned.
1030+ ClonedSizeBytes uint64 `json:"clonedSizeBytes "`
10151031
10161032 // Completed indicates if the initial sync is completed.
10171033 Completed bool `json:"completed"`
0 commit comments