diff --git a/app/vmagent/remotewrite/remotewrite.go b/app/vmagent/remotewrite/remotewrite.go index 8b8b2a52c2..c436111953 100644 --- a/app/vmagent/remotewrite/remotewrite.go +++ b/app/vmagent/remotewrite/remotewrite.go @@ -1034,14 +1034,6 @@ func (rwctx *remoteWriteCtx) TryPushTimeSeries(tss []prompb.TimeSeries, forceDro matchIdxsPool.Put(matchIdxs) } - if len(rwctx.obfuscationLabels) != 0 { - if rctx == nil { - rctx = getRelabelCtx() - v = tssPool.Get().(*[]prompb.TimeSeries) - tss = append(*v, tss...) - } - tss = rwctx.applyObfuscation(tss) - } if rwctx.deduplicator != nil { rwctx.deduplicator.Push(tss) return true @@ -1134,6 +1126,15 @@ func (rwctx *remoteWriteCtx) tryPushTimeSeriesInternal(tss []prompb.TimeSeries) rctx.appendExtraLabels(tss, labelsGlobal) } + if len(rwctx.obfuscationLabels) != 0 { + if rctx == nil { + rctx = getRelabelCtx() + v = tssPool.Get().(*[]prompb.TimeSeries) + tss = append(*v, tss...) + } + tss = rwctx.applyObfuscation(tss) + } + pss := rwctx.pss idx := rwctx.pssNextIdx.Add(1) % uint64(len(pss)) diff --git a/docs/victoriametrics/changelog/CHANGELOG.md b/docs/victoriametrics/changelog/CHANGELOG.md index 7a43026ca3..7536c18218 100644 --- a/docs/victoriametrics/changelog/CHANGELOG.md +++ b/docs/victoriametrics/changelog/CHANGELOG.md @@ -27,6 +27,7 @@ See also [LTS releases](https://docs.victoriametrics.com/victoriametrics/lts-rel ## tip ## [v1.140.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.140.0) +* FEATURE: [vmagent](https://docs.victoriametrics.com/victoriametrics/vmagent/): introduce obfuscation functionality for remote write. By setting `-remoteWrite.obfuscationLabels`, the values of the specific labels will be anonymized before they're sent to corresponding `-remoteWrite.url`. See [#10599](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10599). Released at 2026-04-10 diff --git a/docs/victoriametrics/vmagent.md b/docs/victoriametrics/vmagent.md index 4dd2d84361..d4c8b2c4ea 100644 --- a/docs/victoriametrics/vmagent.md +++ b/docs/victoriametrics/vmagent.md @@ -542,9 +542,9 @@ Use `-remoteWrite.obfuscationLabels` to specify the labels that need to be obfus ```sh ./vmagent \ -remoteWrite.url=http:// \ - -remoteWrite.obfuscatedLabels='instance^^datacenter' \ + -remoteWrite.obfuscationLabels='instance^^datacenter' \ -remoteWrite.url=http:// \ - -remoteWrite.obfuscatedLabels='job' + -remoteWrite.obfuscationLabels='job' ``` ## Automatically generated metrics