app/vmagent: add -influxDBLabel in the same way as for app/vminsert

This is a follow-up for 3d19fa6932
This commit is contained in:
Aliaksandr Valialkin 2022-02-21 14:03:00 +02:00
parent e5ebdb9b1a
commit 979d89f5dd
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
6 changed files with 13 additions and 2 deletions

View file

@ -1713,6 +1713,8 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li
-influx.maxLineSize size -influx.maxLineSize size
The maximum size in bytes for a single InfluxDB line during parsing The maximum size in bytes for a single InfluxDB line during parsing
Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144)
-influxDBLabel string
Default label for the DB name sent over '?db={db_name}' query parameter (default "db")
-influxListenAddr string -influxListenAddr string
TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<victoriametrics>:8428/write TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<victoriametrics>:8428/write
-influxMeasurementFieldSeparator string -influxMeasurementFieldSeparator string

View file

@ -771,6 +771,8 @@ See the docs at https://docs.victoriametrics.com/vmagent.html .
-influx.maxLineSize size -influx.maxLineSize size
The maximum size in bytes for a single InfluxDB line during parsing The maximum size in bytes for a single InfluxDB line during parsing
Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144)
-influxDBLabel string
Default label for the DB name sent over '?db={db_name}' query parameter (default "db")
-influxListenAddr string -influxListenAddr string
TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<vmagent>:8429/write TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<vmagent>:8429/write
-influxMeasurementFieldSeparator string -influxMeasurementFieldSeparator string

View file

@ -24,6 +24,7 @@ var (
measurementFieldSeparator = flag.String("influxMeasurementFieldSeparator", "_", "Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol") measurementFieldSeparator = flag.String("influxMeasurementFieldSeparator", "_", "Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol")
skipSingleField = flag.Bool("influxSkipSingleField", false, "Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field") skipSingleField = flag.Bool("influxSkipSingleField", false, "Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field")
skipMeasurement = flag.Bool("influxSkipMeasurement", false, "Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator'") skipMeasurement = flag.Bool("influxSkipMeasurement", false, "Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator'")
dbLabel = flag.String("influxDBLabel", "db", "Default label for the DB name sent over '?db={db_name}' query parameter")
) )
var ( var (
@ -80,7 +81,7 @@ func insertRows(at *auth.Token, db string, rows []parser.Row, extraLabels []prom
hasDBKey := false hasDBKey := false
for j := range r.Tags { for j := range r.Tags {
tag := &r.Tags[j] tag := &r.Tags[j]
if tag.Key == "db" { if tag.Key == *dbLabel {
hasDBKey = true hasDBKey = true
} }
commonLabels = append(commonLabels, prompbmarshal.Label{ commonLabels = append(commonLabels, prompbmarshal.Label{
@ -90,7 +91,7 @@ func insertRows(at *auth.Token, db string, rows []parser.Row, extraLabels []prom
} }
if len(db) > 0 && !hasDBKey { if len(db) > 0 && !hasDBKey {
commonLabels = append(commonLabels, prompbmarshal.Label{ commonLabels = append(commonLabels, prompbmarshal.Label{
Name: "db", Name: *dbLabel,
Value: db, Value: db,
}) })
} }

View file

@ -1713,6 +1713,8 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li
-influx.maxLineSize size -influx.maxLineSize size
The maximum size in bytes for a single InfluxDB line during parsing The maximum size in bytes for a single InfluxDB line during parsing
Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144)
-influxDBLabel string
Default label for the DB name sent over '?db={db_name}' query parameter (default "db")
-influxListenAddr string -influxListenAddr string
TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<victoriametrics>:8428/write TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<victoriametrics>:8428/write
-influxMeasurementFieldSeparator string -influxMeasurementFieldSeparator string

View file

@ -1717,6 +1717,8 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li
-influx.maxLineSize size -influx.maxLineSize size
The maximum size in bytes for a single InfluxDB line during parsing The maximum size in bytes for a single InfluxDB line during parsing
Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144)
-influxDBLabel string
Default label for the DB name sent over '?db={db_name}' query parameter (default "db")
-influxListenAddr string -influxListenAddr string
TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<victoriametrics>:8428/write TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<victoriametrics>:8428/write
-influxMeasurementFieldSeparator string -influxMeasurementFieldSeparator string

View file

@ -775,6 +775,8 @@ See the docs at https://docs.victoriametrics.com/vmagent.html .
-influx.maxLineSize size -influx.maxLineSize size
The maximum size in bytes for a single InfluxDB line during parsing The maximum size in bytes for a single InfluxDB line during parsing
Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144)
-influxDBLabel string
Default label for the DB name sent over '?db={db_name}' query parameter (default "db")
-influxListenAddr string -influxListenAddr string
TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<vmagent>:8429/write TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://<vmagent>:8429/write
-influxMeasurementFieldSeparator string -influxMeasurementFieldSeparator string