Skip to content

Commit ec73975

Browse files
committed
Update docs for link parameter formatting
Signed-off-by: Drew Corlin <[email protected]>
1 parent 67dc2a5 commit ec73975

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

content/docs/next-release-v2/frontend-ui.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ An example configuration file (see [complete schema here](https://github.com/jae
6666
"key": "uniqueId",
6767
"url": "https://mykibana.com/uniqueId=#{uniqueId}&traceId=#{trace.traceID}",
6868
"text": "Redirect to kibana to view log"
69+
},
70+
{
71+
"type": "traces",
72+
"url": "https://my-logs.server?from=#{startTime | add -60000000 | epoch_micros_to_date_iso}&to=#{endTime | add 60000000 | epoch_micros_to_date_iso}'",
73+
"text": "Redirect to kibana to view log with formatted dates"
6974
}]
7075
}
7176
```
@@ -146,6 +151,40 @@ For traces, the supported template fields are: `duration`, `endTime`, `startTime
146151

147152
Further, the trace template fields are available for substitution in process/logs/tags type when the trace template fields are prefixed with `trace.`. For example: `trace.traceID`, `trace.startTime`.
148153

154+
#### Formatting
155+
156+
In addition to interpolating fields into links, formatting functions can be used. The syntax is `#{field | function}` (eg `#{endTime | epoch_micros_to_date_iso}'`). Formatting functions can be chained together (eg `#{startTime | add 60000000 | epoch_micros_to_date_iso}`).
157+
158+
The available formatting functions and a description of their behavior are:
159+
160+
##### `epoch_micros_to_date_iso`
161+
162+
Format a date in microseconds since epoch to an ISO date time.
163+
164+
Example:
165+
`#{endTime | epoch_micros_to_date_iso}`
166+
167+
##### `pad_start`
168+
169+
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)
170+
171+
Arguments:
172+
173+
- `targetLength` (integer) - Desired length of the string after padding
174+
- `padCharacter` (string) - String to pad the start of the input string with
175+
176+
Example: `#{traceID | pad_start 32 0}`
177+
178+
##### `add`
179+
180+
Add a value to another number. Can be positive or negative.
181+
182+
Arguments:
183+
184+
- `offset` (integer) - Value to add to the input number
185+
186+
Example: `#{startTime | add 1000000}`
187+
149188
## Embedded Mode
150189

151190
Starting with version 1.9, Jaeger UI provides an "embedded" layout mode which is intended to support integrating Jaeger UI into other applications. Currently (as of `v0`), the approach taken is to remove various UI elements from the page to make the UI better suited for space-constrained layouts.

content/docs/next-release/frontend-ui.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ An example configuration file (see [complete schema here](https://github.com/jae
6666
"key": "uniqueId",
6767
"url": "https://mykibana.com/uniqueId=#{uniqueId}&traceId=#{trace.traceID}",
6868
"text": "Redirect to kibana to view log"
69+
},
70+
{
71+
"type": "traces",
72+
"url": "https://my-logs.server?from=#{startTime | add -60000000 | epoch_micros_to_date_iso}&to=#{endTime | add 60000000 | epoch_micros_to_date_iso}'",
73+
"text": "Redirect to kibana to view log with formatted dates"
6974
}]
7075
}
7176
```
@@ -146,6 +151,40 @@ For traces, the supported template fields are: `duration`, `endTime`, `startTime
146151

147152
Further, the trace template fields are available for substitution in process/logs/tags type when the trace template fields are prefixed with `trace.`. For example: `trace.traceID`, `trace.startTime`.
148153

154+
#### Formatting
155+
156+
In addition to interpolating fields into links, formatting functions can be used. The syntax is `#{field | function}` (eg `#{endTime | epoch_micros_to_date_iso}'`). Formatting functions can be chained together (eg `#{startTime | add 60000000 | epoch_micros_to_date_iso}`).
157+
158+
The available formatting functions and a description of their behavior are:
159+
160+
##### `epoch_micros_to_date_iso`
161+
162+
Format a date in microseconds since epoch to an ISO date time.
163+
164+
Example:
165+
`#{endTime | epoch_micros_to_date_iso}`
166+
167+
##### `pad_start`
168+
169+
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)
170+
171+
Arguments:
172+
173+
- `targetLength` (integer) - Desired length of the string after padding
174+
- `padCharacter` (string) - String to pad the start of the input string with
175+
176+
Example: `#{traceID | pad_start 32 0}`
177+
178+
##### `add`
179+
180+
Add a value to another number. Can be positive or negative.
181+
182+
Arguments:
183+
184+
- `offset` (integer) - Value to add to the input number
185+
186+
Example: `#{startTime | add 1000000}`
187+
149188
## Embedded Mode
150189

151190
Starting with version 1.9, Jaeger UI provides an "embedded" layout mode which is intended to support integrating Jaeger UI into other applications. Currently (as of `v0`), the approach taken is to remove various UI elements from the page to make the UI better suited for space-constrained layouts.

0 commit comments

Comments
 (0)