Add commit tag so we have that info as well

This commit is contained in:
Nate Walck 2020-02-25 19:59:51 -05:00
parent 2d2aefea16
commit 0ce86e999a

View File

@ -39,6 +39,7 @@ const (
var ( var (
lotusInfo = stats.Int64("version", "Arbitrary counter to tag lotus info to", stats.UnitDimensionless) lotusInfo = stats.Int64("version", "Arbitrary counter to tag lotus info to", stats.UnitDimensionless)
version, _ = tag.NewKey("version") version, _ = tag.NewKey("version")
commit, _ = tag.NewKey("commit")
) )
// DaemonCmd is the `go-lotus daemon` command // DaemonCmd is the `go-lotus daemon` command
@ -98,7 +99,7 @@ var DaemonCmd = &cli.Command{
defer pprof.StopCPUProfile() defer pprof.StopCPUProfile()
} }
ctx, _ := tag.New(context.Background(), tag.Insert(version, build.BuildVersion)) ctx, _ := tag.New(context.Background(), tag.Insert(version, build.BuildVersion), tag.Insert(commit, build.CurrentCommit))
{ {
dir, err := homedir.Expand(cctx.String("repo")) dir, err := homedir.Expand(cctx.String("repo"))
if err != nil { if err != nil {
@ -187,7 +188,7 @@ var DaemonCmd = &cli.Command{
Description: "Lotus node information", Description: "Lotus node information",
Measure: lotusInfo, Measure: lotusInfo,
Aggregation: view.LastValue(), Aggregation: view.LastValue(),
TagKeys: []tag.Key{version}, TagKeys: []tag.Key{version, commit},
}, },
); err != nil { ); err != nil {
log.Fatalf("Cannot register the view: %v", err) log.Fatalf("Cannot register the view: %v", err)