mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
app/vminsert/influx: add -influxMeasurementFieldSeparator flag for the ability to change separator for {measurement}{separator}{field_name}
metric name
This commit is contained in:
parent
14edd122a6
commit
5f0b3589b2
1 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@ package influx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -19,6 +20,10 @@ import (
|
||||||
"github.com/VictoriaMetrics/metrics"
|
"github.com/VictoriaMetrics/metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
measurementFieldSeparator = flag.String("influxMeasurementFieldSeparator", ".", "Separator for `{measurement}{separator}{field_name}` metric name when inserted via Influx line protocol")
|
||||||
|
)
|
||||||
|
|
||||||
var rowsInserted = tenantmetrics.NewCounterMap(`vm_rows_inserted_total{type="influx"}`)
|
var rowsInserted = tenantmetrics.NewCounterMap(`vm_rows_inserted_total{type="influx"}`)
|
||||||
|
|
||||||
// InsertHandler processes remote write for influx line protocol.
|
// InsertHandler processes remote write for influx line protocol.
|
||||||
|
@ -89,7 +94,7 @@ func (ctx *pushCtx) InsertRows(at *auth.Token, db string) error {
|
||||||
ic.MetricNameBuf = storage.MarshalMetricNameRaw(ic.MetricNameBuf[:0], at.AccountID, at.ProjectID, ic.Labels)
|
ic.MetricNameBuf = storage.MarshalMetricNameRaw(ic.MetricNameBuf[:0], at.AccountID, at.ProjectID, ic.Labels)
|
||||||
metricNameBufLen := len(ic.MetricNameBuf)
|
metricNameBufLen := len(ic.MetricNameBuf)
|
||||||
ctx.metricGroupBuf = append(ctx.metricGroupBuf[:0], r.Measurement...)
|
ctx.metricGroupBuf = append(ctx.metricGroupBuf[:0], r.Measurement...)
|
||||||
ctx.metricGroupBuf = append(ctx.metricGroupBuf, '.')
|
ctx.metricGroupBuf = append(ctx.metricGroupBuf, *measurementFieldSeparator...)
|
||||||
metricGroupPrefixLen := len(ctx.metricGroupBuf)
|
metricGroupPrefixLen := len(ctx.metricGroupBuf)
|
||||||
ic.AddLabel("", "placeholder")
|
ic.AddLabel("", "placeholder")
|
||||||
placeholderLabel := &ic.Labels[len(ic.Labels)-1]
|
placeholderLabel := &ic.Labels[len(ic.Labels)-1]
|
||||||
|
|
Loading…
Reference in a new issue