From 9149e34b8dc3b23c0b91d4f0e00bcb82cee6f70f Mon Sep 17 00:00:00 2001 From: Drew Corlin Date: Sun, 1 Dec 2024 12:41:57 -0500 Subject: [PATCH] Add more formatting functions and function chaining Signed-off-by: Drew Corlin --- content/docs/next-release-v2/frontend-ui.md | 10 +++++++--- content/docs/next-release/frontend-ui.md | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/content/docs/next-release-v2/frontend-ui.md b/content/docs/next-release-v2/frontend-ui.md index f11b51ed..d14a3918 100644 --- a/content/docs/next-release-v2/frontend-ui.md +++ b/content/docs/next-release-v2/frontend-ui.md @@ -154,9 +154,13 @@ Further, the trace template fields are available for substitution in process/log #### Formatting In addition to interpolating fields into links, formatting functions can be used. The syntax is `#{field | function}` (eg `#{endTime | epoch_micros_to_date_iso}'`). The available formatting functions and a description of their behavior are: -| Function | Description | Example | -| -------- | ----------- | ------- | -| `epoch_micros_to_date_iso` | Format a date in microseconds since epoch to an ISO date time | `#{endTime \| epoch_micros_to_date_iso}` | +| Function name | Arguments | Description | Example | +| ------------- | --------- | ----------- | ------- | +| `epoch_micros_to_date_iso` | - | Format a date in microseconds since epoch to an ISO date time | `#{endTime \| epoch_micros_to_date_iso}` | +| `pad_start` | 1.`targetLength`(integer) 2.`padCharacter`(string) | Pad the start of a string with a given character until the resulting string reaches the given length. Behavior is implemented by and thus matches javascript's [String.padStart](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) | `#{traceID \| pad_start 32 0}`| +| `add` | 1.`offset`(integer) | Add a value to another number. Can be positive or negative | `#{startTime \| add 1000000}`| + +Formatting functions can be chained together. For example `#{startTime | add 60000000 | epoch_micros_to_date_iso}`. ## Embedded Mode diff --git a/content/docs/next-release/frontend-ui.md b/content/docs/next-release/frontend-ui.md index 59d6e003..ef8c45a3 100644 --- a/content/docs/next-release/frontend-ui.md +++ b/content/docs/next-release/frontend-ui.md @@ -154,9 +154,13 @@ Further, the trace template fields are available for substitution in process/log #### Formatting In addition to interpolating fields into links, formatting functions can be used. The syntax is `#{field | function}` (eg `#{endTime | epoch_micros_to_date_iso}'`). The available formatting functions and a description of their behavior are: -| Function | Description | Example | -| -------- | ----------- | ------- | -| `epoch_micros_to_date_iso` | Format a date in microseconds since epoch to an ISO date time | `#{endTime \| epoch_micros_to_date_iso}` | +| Function name | Arguments | Description | Example | +| ------------- | --------- | ----------- | ------- | +| `epoch_micros_to_date_iso` | - | Format a date in microseconds since epoch to an ISO date time | `#{endTime \| epoch_micros_to_date_iso}` | +| `pad_start` | 1.`targetLength`(integer) 2.`padCharacter`(string) | Pad the start of a string with a given character until the resulting string reaches the given length. Behavior is implemented by and thus matches javascript's [String.padStart](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) | `#{traceID \| pad_start 32 0}`| +| `add` | 1.`offset`(integer) | Add a value to another number. Can be positive or negative | `#{startTime \| add 1000000}`| + +Formatting functions can be chained together. For example `#{startTime | add 60000000 | epoch_micros_to_date_iso}`. ## Embedded Mode