aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2019-01-29 16:14:24 +0800
committerFelix Lange <fjl@users.noreply.github.com>2019-01-29 16:14:24 +0800
commit21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e (patch)
tree3ce729edabe2bb62ac5579dad5e9f3c0d7d010c9 /cmd/swarm
parentb04da9d48227b5d020a9668d06a5b92cb6746540 (diff)
downloadgo-tangerine-21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e.tar
go-tangerine-21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e.tar.gz
go-tangerine-21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e.tar.bz2
go-tangerine-21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e.tar.lz
go-tangerine-21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e.tar.xz
go-tangerine-21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e.tar.zst
go-tangerine-21acf0bc8d4f179397bb7d06d6f36df3cbee4a8e.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).
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 f7f358ef1..ebd0c9715 100644
--- a/cmd/swarm/swarm-smoke/main.go
+++ b/cmd/swarm/swarm-smoke/main.go
@@ -130,7 +130,7 @@ func main() {
swarmmetrics.MetricsInfluxDBDatabaseFlag,
swarmmetrics.MetricsInfluxDBUsernameFlag,
swarmmetrics.MetricsInfluxDBPasswordFlag,
- swarmmetrics.MetricsInfluxDBHostTagFlag,
+ swarmmetrics.MetricsInfluxDBTagsFlag,
}...)
app.Flags = append(app.Flags, tracing.Flags...)
@@ -183,13 +183,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