diff --git a/app/vminsert/influx/request_handler.go b/app/vminsert/influx/request_handler.go index 3b1ae6c38..40ede91c8 100644 --- a/app/vminsert/influx/request_handler.go +++ b/app/vminsert/influx/request_handler.go @@ -23,6 +23,7 @@ var ( 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") 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 ( @@ -80,13 +81,13 @@ func insertRows(db string, rows []parser.Row, extraLabels []prompbmarshal.Label) hasDBKey := false for j := range r.Tags { tag := &r.Tags[j] - if tag.Key == "db" { + if tag.Key == *dbLabel { hasDBKey = true } ic.AddLabel(tag.Key, tag.Value) } if !hasDBKey { - ic.AddLabel("db", db) + ic.AddLabel(*dbLabel, db) } for j := range extraLabels { label := &extraLabels[j]