Skip to content

Commit

Permalink
http api: reduce status api (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoppro authored May 21, 2020
1 parent 7401b25 commit 501016c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cdc/http_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/pingcap/log"
"github.com/pingcap/ticdc/cdc/kv"
"github.com/pingcap/ticdc/pkg/util"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.etcd.io/etcd/clientv3"
Expand Down Expand Up @@ -71,6 +72,7 @@ type status struct {
GitHash string `json:"git_hash"`
ID string `json:"id"`
Pid int `json:"pid"`
IsOwner bool `json:"is_owner"`
}

func (s *Server) writeEtcdInfo(ctx context.Context, cli kv.CDCEtcdClient, w io.Writer) {
Expand Down Expand Up @@ -101,13 +103,14 @@ func (s *Server) handleDebugInfo(w http.ResponseWriter, req *http.Request) {

func (s *Server) handleStatus(w http.ResponseWriter, req *http.Request) {
st := status{
Version: "0.0.1",
GitHash: "",
Version: util.ReleaseVersion,
GitHash: util.GitHash,
Pid: os.Getpid(),
}
if s.capture != nil {
st.ID = s.capture.info.ID
}
st.IsOwner = s.owner != nil
writeData(w, st)
}

Expand Down

0 comments on commit 501016c

Please sign in to comment.