aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2019-01-29 16:14:24 +0800
committerRafael Matias <rafael@skyle.net>2019-02-20 00:34:48 +0800
commit4f908db69e8cb69cdf45775c7c75e74244e91653 (patch)
tree62f6d418263720447e68b5f14ad744eb6390c697 /cmd/swarm
parent320d132925ca0452272f80bfa7af491e5f7d39e5 (diff)
downloadgo-tangerine-4f908db69e8cb69cdf45775c7c75e74244e91653.tar
go-tangerine-4f908db69e8cb69cdf45775c7c75e74244e91653.tar.gz
go-tangerine-4f908db69e8cb69cdf45775c7c75e74244e91653.tar.bz2
go-tangerine-4f908db69e8cb69cdf45775c7c75e74244e91653.tar.lz
go-tangerine-4f908db69e8cb69cdf45775c7c75e74244e91653.tar.xz
go-tangerine-4f908db69e8cb69cdf45775c7c75e74244e91653.tar.zst
go-tangerine-4f908db69e8cb69cdf45775c7c75e74244e91653.zip
cmd/utils: allow for multiple influxdb tags (#18520)
This PR is replacing the metrics.influxdb.host.tag cmd-line flag with metrics.influxdb.tags - a comma-separated key/value tags, that are passed to the InfluxDB reporter, so that we can index measurements with multiple tags, and not just one host tag. This will be useful for Swarm, where we want to index measurements not just with the host tag, but also with bzzkey and git commit version (for long-running deployments). (cherry picked from commit 21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e)
Diffstat (limited to 'cmd/swarm')
-rw-r--r--cmd/swarm/swarm-smoke/main.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/cmd/swarm/swarm-smoke/main.go b/cmd/swarm/swarm-smoke/main.go
index 4f28e86b1..43d2c1ff5 100644
--- a/cmd/swarm/swarm-smoke/main.go
+++ b/cmd/swarm/swarm-smoke/main.go
@@ -117,7 +117,7 @@ func main() {
swarmmetrics.MetricsInfluxDBDatabaseFlag,
swarmmetrics.MetricsInfluxDBUsernameFlag,
swarmmetrics.MetricsInfluxDBPasswordFlag,
- swarmmetrics.MetricsInfluxDBHostTagFlag,
+ swarmmetrics.MetricsInfluxDBTagsFlag,
}...)
app.Flags = append(app.Flags, tracing.Flags...)
@@ -176,13 +176,14 @@ func emitMetrics(ctx *cli.Context) error {
database = ctx.GlobalString(swarmmetrics.MetricsInfluxDBDatabaseFlag.Name)
username = ctx.GlobalString(swarmmetrics.MetricsInfluxDBUsernameFlag.Name)
password = ctx.GlobalString(swarmmetrics.MetricsInfluxDBPasswordFlag.Name)
- hosttag = ctx.GlobalString(swarmmetrics.MetricsInfluxDBHostTagFlag.Name)
+ tags = ctx.GlobalString(swarmmetrics.MetricsInfluxDBTagsFlag.Name)
)
- return influxdb.InfluxDBWithTagsOnce(gethmetrics.DefaultRegistry, endpoint, database, username, password, "swarm-smoke.", map[string]string{
- "host": hosttag,
- "version": gitCommit,
- "filesize": fmt.Sprintf("%v", filesize),
- })
+
+ tagsMap := utils.SplitTagsFlag(tags)
+ tagsMap["version"] = gitCommit
+ tagsMap["filesize"] = fmt.Sprintf("%v", filesize)
+
+ return influxdb.InfluxDBWithTagsOnce(gethmetrics.DefaultRegistry, endpoint, database, username, password, "swarm-smoke.", tagsMap)
}
return nil