aboutsummaryrefslogtreecommitdiffstats
path: root/swarm
diff options
context:
space:
mode:
authorJerzy Lasyk <jerzylasyk@gmail.com>2019-01-25 01:57:20 +0800
committerAnton Evangelatov <anton.evangelatov@gmail.com>2019-01-25 01:57:20 +0800
commitf28da4f602fcd17624cf6d40d070253dd6663121 (patch)
treea3b817d944d85b3b99f60d93dc08a7a05127b319 /swarm
parent2abeb35d5425d72c2f7fdfe4209f7a94fac52a8e (diff)
downloadgo-tangerine-f28da4f602fcd17624cf6d40d070253dd6663121.tar
go-tangerine-f28da4f602fcd17624cf6d40d070253dd6663121.tar.gz
go-tangerine-f28da4f602fcd17624cf6d40d070253dd6663121.tar.bz2
go-tangerine-f28da4f602fcd17624cf6d40d070253dd6663121.tar.lz
go-tangerine-f28da4f602fcd17624cf6d40d070253dd6663121.tar.xz
go-tangerine-f28da4f602fcd17624cf6d40d070253dd6663121.tar.zst
go-tangerine-f28da4f602fcd17624cf6d40d070253dd6663121.zip
swarm/metrics: Send the accounting registry to InfluxDB (#18470)
Diffstat (limited to 'swarm')
-rw-r--r--swarm/metrics/flags.go25
1 files changed, 19 insertions, 6 deletions
diff --git a/swarm/metrics/flags.go b/swarm/metrics/flags.go
index 7c12120a6..38d30d997 100644
--- a/swarm/metrics/flags.go
+++ b/swarm/metrics/flags.go
@@ -31,6 +31,10 @@ var (
Name: "metrics.influxdb.export",
Usage: "Enable metrics export/push to an external InfluxDB database",
}
+ MetricsEnableInfluxDBAccountingExportFlag = cli.BoolFlag{
+ Name: "metrics.influxdb.accounting",
+ Usage: "Enable accounting metrics export/push to an external InfluxDB database",
+ }
MetricsInfluxDBEndpointFlag = cli.StringFlag{
Name: "metrics.influxdb.endpoint",
Usage: "Metrics InfluxDB endpoint",
@@ -66,6 +70,7 @@ var (
var Flags = []cli.Flag{
utils.MetricsEnabledFlag,
MetricsEnableInfluxDBExportFlag,
+ MetricsEnableInfluxDBAccountingExportFlag,
MetricsInfluxDBEndpointFlag,
MetricsInfluxDBDatabaseFlag,
MetricsInfluxDBUsernameFlag,
@@ -77,12 +82,13 @@ func Setup(ctx *cli.Context) {
if gethmetrics.Enabled {
log.Info("Enabling swarm metrics collection")
var (
- enableExport = ctx.GlobalBool(MetricsEnableInfluxDBExportFlag.Name)
- endpoint = ctx.GlobalString(MetricsInfluxDBEndpointFlag.Name)
- database = ctx.GlobalString(MetricsInfluxDBDatabaseFlag.Name)
- username = ctx.GlobalString(MetricsInfluxDBUsernameFlag.Name)
- password = ctx.GlobalString(MetricsInfluxDBPasswordFlag.Name)
- hosttag = ctx.GlobalString(MetricsInfluxDBHostTagFlag.Name)
+ enableExport = ctx.GlobalBool(MetricsEnableInfluxDBExportFlag.Name)
+ enableAccountingExport = ctx.GlobalBool(MetricsEnableInfluxDBAccountingExportFlag.Name)
+ endpoint = ctx.GlobalString(MetricsInfluxDBEndpointFlag.Name)
+ database = ctx.GlobalString(MetricsInfluxDBDatabaseFlag.Name)
+ username = ctx.GlobalString(MetricsInfluxDBUsernameFlag.Name)
+ password = ctx.GlobalString(MetricsInfluxDBPasswordFlag.Name)
+ hosttag = ctx.GlobalString(MetricsInfluxDBHostTagFlag.Name)
)
// Start system runtime metrics collection
@@ -94,5 +100,12 @@ func Setup(ctx *cli.Context) {
"host": hosttag,
})
}
+
+ if enableAccountingExport {
+ log.Info("Exporting accounting metrics to InfluxDB")
+ go influxdb.InfluxDBWithTags(gethmetrics.AccountingRegistry, 10*time.Second, endpoint, database, username, password, "accounting.", map[string]string{
+ "host": hosttag,
+ })
+ }
}
}