address review

This commit is contained in:
Jayice
2026-04-17 14:31:52 +08:00
parent ec9d37ce36
commit 9bd219fdc7
3 changed files with 12 additions and 10 deletions

View File

@@ -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))

View File

@@ -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

View File

@@ -542,9 +542,9 @@ Use `-remoteWrite.obfuscationLabels` to specify the labels that need to be obfus
```sh
./vmagent \
-remoteWrite.url=http://<external-service> \
-remoteWrite.obfuscatedLabels='instance^^datacenter' \
-remoteWrite.obfuscationLabels='instance^^datacenter' \
-remoteWrite.url=http://<internal-url> \
-remoteWrite.obfuscatedLabels='job'
-remoteWrite.obfuscationLabels='job'
```
## Automatically generated metrics