Skip to content

Commit

Permalink
feat: add network tag to metrics (#12733)
Browse files Browse the repository at this point in the history
  • Loading branch information
virajbhartiya authored Dec 18, 2024
1 parent 2db09ad commit a584745
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 45 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- During a network upgrade, log migration progress every 2 seconds so they are more helpful and informative. The `LOTUS_MIGRATE_PROGRESS_LOG_SECONDS` environment variable can be used to change this if needed. ([filecoin-project/lotus#12732](https://github.com/filecoin-project/lotus/pull/12732))
- Add F3GetCertificate & F3GetLatestCertificate to the gateway. ([filecoin-project/lotus#12778](https://github.com/filecoin-project/lotus/pull/12778))
- Add Magik's bootstrap node. ([filecoin-project/lotus#12792](https://github.com/filecoin-project/lotus/pull/12792))
- Lotus now reports the network name as a tag in most metrics. Some untagged metrics will be completed in a follow-up at a later date. ([filecoin-project/lotus#12733](https://github.com/filecoin-project/lotus/pull/12733))

# UNRELEASED v.1.32.0

Expand Down
6 changes: 5 additions & 1 deletion blockstore/splitstore/splitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ func Open(path string, ds dstore.Datastore, hot, cold bstore.Blockstore, cfg *Co
ss.txnViewsCond.L = &ss.txnViewsMx
ss.txnSyncCond.L = &ss.txnSyncMx
ss.chainSyncCond.L = &ss.chainSyncMx
ss.ctx, ss.cancel = context.WithCancel(context.Background())

baseCtx := context.Background()
ctx := metrics.AddNetworkTag(baseCtx)

ss.ctx, ss.cancel = context.WithCancel(ctx)

ss.reifyCond.L = &ss.reifyMx
ss.reifyPend = make(map[cid.Cid]struct{})
Expand Down
1 change: 1 addition & 0 deletions cmd/lotus-miner/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var runCmd = &cli.Command{
tag.Insert(metrics.Commit, build.CurrentCommit),
tag.Insert(metrics.NodeType, "miner"),
)
ctx = metrics.AddNetworkTag(ctx)
// Register all metric views
if err := view.Register(
metrics.MinerNodeViews...,
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ var DaemonCmd = &cli.Command{
default:
return fmt.Errorf("unrecognized profile type: %q", profile)
}

ctx, _ := tag.New(context.Background(),
tag.Insert(metrics.Version, build.NodeBuildVersion),
tag.Insert(metrics.Commit, build.CurrentCommit),
tag.Insert(metrics.NodeType, "chain"),
)
ctx = metrics.AddNetworkTag(ctx)
// Register all metric views
if err = view.Register(
metrics.ChainNodeViews...,
Expand Down
Loading

0 comments on commit a584745

Please sign in to comment.