Skip to content

Commit 2a70bae

Browse files
authored
feat: wallet exporter (#574)
* basic wallet exporter * plumb into the constructor * fix lint * increasing bucket order * make gen * move wallet exporter config to subsystems * missing file * docs * post-merge make gen
1 parent 682a1e8 commit 2a70bae

File tree

8 files changed

+651
-0
lines changed

8 files changed

+651
-0
lines changed

deps/config/doc_gen.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/config/types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ type CurioSubsystemsConfig struct {
411411
EnableRemoteProofs bool
412412

413413
RemoteProofMaxUploads int
414+
415+
// EnableWalletExporter enables the wallet exporter on the node. This will export wallet stats to prometheus.
416+
// NOTE: THIS MUST BE ENABLED ONLY ON A SINGLE NODE IN THE CLUSTER TO BE USEFUL (Default: false)
417+
EnableWalletExporter bool
414418
}
415419
type CurioFees struct {
416420
// maxBatchFee = maxBase + maxPerSector * nSectors

deps/deps.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"github.com/filecoin-project/curio/alertmanager/curioalerting"
3535
"github.com/filecoin-project/curio/api"
3636
"github.com/filecoin-project/curio/deps/config"
37+
"github.com/filecoin-project/curio/deps/stats"
3738
"github.com/filecoin-project/curio/harmony/harmonydb"
3839
"github.com/filecoin-project/curio/lib/cachedreader"
3940
"github.com/filecoin-project/curio/lib/curiochain"
@@ -352,6 +353,15 @@ Get it with: jq .PrivateKey ~/.lotus-miner/keystore/MF2XI2BNNJ3XILLQOJUXMYLUMU`,
352353
}
353354
}
354355

356+
if deps.Cfg.Subsystems.EnableWalletExporter {
357+
spIDs := []address.Address{}
358+
for maddr := range deps.Maddrs {
359+
spIDs = append(spIDs, address.Address(maddr))
360+
}
361+
362+
stats.StartWalletExporter(ctx, deps.DB, deps.Chain, spIDs)
363+
}
364+
355365
if deps.Name == "" {
356366
deps.Name = cctx.String("name")
357367
}

0 commit comments

Comments
 (0)