Skip to content

Commit

Permalink
[pkg/ottl] Update docs of functions impacted by grammar bug (open-tel…
Browse files Browse the repository at this point in the history
…emetry#23259)

Update readme
  • Loading branch information
TylerHelmuth authored Jun 12, 2023
1 parent 6d35fd7 commit 0f8e128
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/ottl/ottlfuncs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ The `replace_all_matches` function replaces any matching string value with the r

Each string value in `target` that matches `pattern` will get replaced with `replacement`. Non-string values are ignored.

There is currently a bug with OTTL that does not allow the pattern to end with `\\"`.
[See Issue 23238 for details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23238).

Examples:

- `replace_all_matches(attributes, "/user/*/list/*", "/user/{userId}/list/{listId}")`
Expand All @@ -170,6 +173,10 @@ If one or more sections of `target` match `regex` they will get replaced with `r

The `replacement` string can refer to matched groups using [regexp.Expand syntax](https://pkg.go.dev/regexp#Regexp.Expand).

There is currently a bug with OTTL that does not allow the pattern to end with `\\"`.
If your pattern needs to end with backslashes, add something inconsequential to the end of the pattern such as `{1}`, `$`, or `.*`.
[See Issue 23238 for details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23238).

Examples:

- `replace_all_patterns(attributes, "value", "/account/\\d{4}", "/account/{accountId}")`
Expand All @@ -190,6 +197,9 @@ The `replace_match` function allows replacing entire strings if they match a glo

If `target` matches `pattern` it will get replaced with `replacement`.

There is currently a bug with OTTL that does not allow the pattern to end with `\\"`.
[See Issue 23238 for details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23238).

Examples:

- `replace_match(attributes["http.target"], "/user/*/list/*", "/user/{userId}/list/{listId}")`
Expand All @@ -206,6 +216,10 @@ If one or more sections of `target` match `regex` they will get replaced with `r

The `replacement` string can refer to matched groups using [regexp.Expand syntax](https://pkg.go.dev/regexp#Regexp.Expand).

There is currently a bug with OTTL that does not allow the pattern to end with `\\"`.
If your pattern needs to end with backslashes, add something inconsequential to the end of the pattern such as `{1}`, `$`, or `.*`.
[See Issue 23238 for details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23238).

Examples:

- `replace_pattern(resource.attributes["process.command_line"], "password\\=[^\\s]*(\\s?)", "password=***")`
Expand Down Expand Up @@ -401,6 +415,9 @@ If target is not a string, it will be converted to one:

If target is nil, false is always returned.

There is currently a bug with OTTL that does not allow the target string to end with `\\"`.
[See Issue 23238 for details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23238).

Examples:

- `IsMatch(attributes["http.path"], "foo")`
Expand Down Expand Up @@ -545,6 +562,9 @@ The `Split` Converter separates a string by the delimiter, and returns an array

If the `target` is not a string or does not exist, the `Split` Converter will return an error.

There is currently a bug with OTTL that does not allow the target string to end with `\\"`.
[See Issue 23238 for details](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23238).

Examples:

- ```Split("A|B|C", "|")```
Expand Down

0 comments on commit 0f8e128

Please sign in to comment.