You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `replace_all_matches` function replaces any matching string value with the replacement string.
147
153
148
-
`target` is a path expression to a `pdata.Map` type field. `pattern` is a string following [filepath.Match syntax](https://pkg.go.dev/path/filepath#Match). `replacement` is either a path expression to a string telemetry field or a literal string. `hashFunction` is an optional argument
149
-
that creates a hash of `replacement` and then replaces any matching string with the hash value.
154
+
`target` is a path expression to a `pdata.Map` type field. `pattern` is a string following [filepath.Match syntax](https://pkg.go.dev/path/filepath#Match). `replacement` is either a path expression to a string telemetry field or a literal string. `function` is an optional argument that can take in any Converter that accepts a (`replacement`) string and returns a string. An example is a hash function that replaces any matching string with the hash value of `replacement`.
150
155
151
156
Each string value in `target` that matches `pattern` will get replaced with `replacement`. Non-string values are ignored.
The `replace_all_patterns` function replaces any segments in a string value or key that match the regex pattern with the replacement string.
166
171
@@ -172,7 +177,7 @@ If one or more sections of `target` match `regex` they will get replaced with `r
172
177
173
178
The `replacement` string can refer to matched groups using [regexp.Expand syntax](https://pkg.go.dev/regexp#Regexp.Expand).
174
179
175
-
The `hashFunction` is an optional argument that creates a hash of `replacement`and then replaces the regex pattern with the hash value.
180
+
The `function` is an optional argument that can take in any Converter that accepts a (`replacement`) string and returns a string. An example is a hash function that replaces any matching regex pattern with the hash value of `replacement`.
176
181
177
182
There is currently a bug with OTTL that does not allow the pattern to end with `\\"`.
178
183
If your pattern needs to end with backslashes, add something inconsequential to the end of the pattern such as `{1}`, `$`, or `.*`.
@@ -191,15 +196,15 @@ If using OTTL outside of collector configuration, `$` should not be escaped and
The `replace_match` function allows replacing entire strings if they match a glob pattern.
197
202
198
203
`target` is a path expression to a telemetry field. `pattern` is a string following [filepath.Match syntax](https://pkg.go.dev/path/filepath#Match). `replacement` is either a path expression to a string telemetry field or a literal string.
199
204
200
205
If `target` matches `pattern` it will get replaced with `replacement`.
201
206
202
-
The `hashFunction` is an optional argument that creates a hash of `replacement`and then replaces entire strings if they match a glob pattern with the hash value.
207
+
The `function` is an optional argument that can take in any Converter that accepts a (`replacement`) string and returns a string. An example is a hash function that replaces any matching glob pattern with the hash value of `replacement`.
203
208
204
209
There is currently a bug with OTTL that does not allow the pattern to end with `\\"`.
205
210
[See Issue 23238 for details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23238).
The `replace_pattern` function allows replacing all string sections that match a regex pattern with a new value.
217
222
@@ -221,7 +226,7 @@ If one or more sections of `target` match `regex` they will get replaced with `r
221
226
222
227
The `replacement` string can refer to matched groups using [regexp.Expand syntax](https://pkg.go.dev/regexp#Regexp.Expand).
223
228
224
-
The `hashFunction` is an optional argument that creates a hash of `replacement`and then replaces all string sections that match a regex pattern with the hash value.
229
+
The `function` is an optional argument that can take in any Converter that accepts a (`replacement`) string and returns a string. An example is a hash function that replaces a matching regex pattern with the hash value of `replacement`.
225
230
226
231
There is currently a bug with OTTL that does not allow the pattern to end with `\\"`.
227
232
If your pattern needs to end with backslashes, add something inconsequential to the end of the pattern such as `{1}`, `$`, or `.*`.
-`Concat(["HTTP method is: ", attributes["http.method"]], "")`
333
344
334
345
### ConvertCase
@@ -402,6 +413,7 @@ Examples:
402
413
403
414
-`FNV(attributes["device.name"])`
404
415
416
+
405
417
-`FNV("name")`
406
418
407
419
### Hours
@@ -441,6 +453,7 @@ Examples:
441
453
442
454
-`Int(attributes["http.status_code"])`
443
455
456
+
444
457
-`Int("2.0")`
445
458
446
459
### IsMap
@@ -457,6 +470,7 @@ Examples:
457
470
458
471
-`IsMap(body)`
459
472
473
+
460
474
-`IsMap(attributes["maybe a map"])`
461
475
462
476
### IsMatch
@@ -485,6 +499,7 @@ Examples:
485
499
486
500
-`IsMatch(attributes["http.path"], "foo")`
487
501
502
+
488
503
-`IsMatch("string", ".*ring")`
489
504
490
505
### IsString
@@ -540,6 +555,7 @@ Examples:
540
555
541
556
-`Log(attributes["duration_ms"])`
542
557
558
+
543
559
-`Int(Log(attributes["duration_ms"])`
544
560
545
561
### Microseconds
@@ -636,8 +652,10 @@ Examples:
636
652
637
653
-`ParseJSON("{\"attr\":true}")`
638
654
655
+
639
656
-`ParseJSON(attributes["kubernetes"])`
640
657
658
+
641
659
-`ParseJSON(body)`
642
660
643
661
### Seconds
@@ -670,6 +688,7 @@ Examples:
670
688
671
689
-`SHA1(attributes["device.name"])`
672
690
691
+
673
692
-`SHA1("name")`
674
693
675
694
**Note:** According to the National Institute of Standards and Technology (NIST), SHA1 is no longer a recommended hash function. It should be avoided except when required for compatibility. New uses should prefer FNV whenever possible.
@@ -690,6 +709,7 @@ Examples:
690
709
691
710
-`SHA256(attributes["device.name"])`
692
711
712
+
693
713
-`SHA256("name")`
694
714
695
715
**Note:** According to the National Institute of Standards and Technology (NIST), SHA256 is no longer a recommended hash function. It should be avoided except when required for compatibility. New uses should prefer FNV whenever possible.
@@ -708,7 +728,7 @@ Examples:
708
728
709
729
### Split
710
730
711
-
`Split(target, delimiter)`
731
+
```Split(target, delimiter)```
712
732
713
733
The `Split` Converter separates a string by the delimiter, and returns an array of substrings.
0 commit comments