Skip to content

Commit

Permalink
Merge pull request #26 from taosdata/enh/sunpeng/TD-23267-change-expi…
Browse files Browse the repository at this point in the history
…re_time-type-and-add-check-health

enh: change expire_time data type and add check health
  • Loading branch information
sunpe authored Mar 21, 2023
2 parents 084633d + beb5d66 commit d46d043
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
21 changes: 21 additions & 0 deletions api/checkhealth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package api

import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/taosdata/taoskeeper/version"
)

func NewCheckHealth() *CheckHealth {
return &CheckHealth{}
}

type CheckHealth struct {
}

func (*CheckHealth) Init(c gin.IRouter) {
c.GET("check_health", func(context *gin.Context) {
context.JSON(http.StatusOK, map[string]string{"version": version.Version})
})
}
12 changes: 6 additions & 6 deletions api/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,16 @@ var CreateSummarySql = "create table if not exists log_summary(" +
") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"

type GrantInfo struct {
ExpireTime int `json:"expire_time"`
TimeseriesUsed int `json:"timeseries_used"`
TimeseriesTotal int `json:"timeseries_total"`
ExpireTime int64 `json:"expire_time"`
TimeseriesUsed int64 `json:"timeseries_used"`
TimeseriesTotal int64 `json:"timeseries_total"`
}

var CreateGrantInfoSql = "create table if not exists grants_info(" +
"ts timestamp, " +
"expire_time int, " +
"timeseries_used int, " +
"timeseries_total int " +
"expire_time bigint, " +
"timeseries_used bigint, " +
"timeseries_total bigint " +
") tags (dnode_id int, dnode_ep nchar(" + dnodeEpLen + "), cluster_id nchar(32))"

var CreateKeeperSql = "create table if not exists keeper_monitor (" +
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func main() {
api.NewAdapterImporter(conf)
node := api.NewNodeExporter(processor)
node.Init(router)
checkHealth := api.NewCheckHealth()
checkHealth.Init(router)

server := &http.Server{
Addr: ":" + strconv.Itoa(conf.Port),
Expand Down

0 comments on commit d46d043

Please sign in to comment.