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
Copy file name to clipboardExpand all lines: docs/patterns/trace.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,18 +16,18 @@ head:
16
16
---
17
17
18
18
# Trace
19
-
**Trace**allow us to take tap into a life-cycle event and identifying performance bottleneck for our app.
19
+
**Trace**allows us to tap into a life-cycle event and identify performance bottlenecks for our app.
20
20
21
21

22
22
23
-
Performance is another one of important aspect for Elysia.
23
+
Performance is another important aspect for Elysia.
24
24
25
-
We don't want to be fast for benchmarking purpose, we want you to have a real fast server in real-world scenario.
25
+
We don't want to be fast for benchmarking purposes, we want you to have a real fast server in real-world scenario.
26
26
27
-
There are many factor that can slow down your app, and it's hard to identifying one, and**trace** can helps solve that problem
27
+
There are many factors that can slow down your app - and it's hard to identify them, but**trace** can helps solve that problem
28
28
29
29
## Trace
30
-
Trace can measure lifecycle execution time of each function to audit performance bottleneck of each cycle.
30
+
Trace can measure lifecycle execution time of each function to audit the performance bottleneck of each cycle.
31
31
32
32
```ts
33
33
import { Elysia } from'elysia'
@@ -56,7 +56,7 @@ Please refers to [lifecycle event](/concept/life-cycle) for more information:
56
56

57
57
58
58
## Children
59
-
You can tap deeper into each measure each function of life-cycle event by using children property of a life-cycle
59
+
You can tap deeper and measure each function of a life-cycle event by using the **children** property of a life-cycle event
60
60
61
61
```ts
62
62
import { Elysia } from'elysia'
@@ -88,7 +88,7 @@ Every life cycle has support for children except for `handle`
88
88
:::
89
89
90
90
## Name
91
-
Measuring function by index can be hard to trace back to the function code, that's why trace provide a **name** property to easily identify the function by name.
91
+
Measuring functions by index can be hard to trace back to the function code, that's why trace provides a **name** property to easily identify the function by name.
92
92
93
93
```ts
94
94
import { Elysia } from'elysia'
@@ -113,13 +113,13 @@ const app = new Elysia()
113
113
```
114
114
115
115
::: tip
116
-
If you are using arrow function or unnamed function, **name** will become **"anonymous"**
116
+
If you are using an arrow function or unnamed function, **name** will become **"anonymous"**
117
117
:::
118
118
119
119
## Set
120
-
Inside trace calback, you can access `Context` of the request, and can mutate the value of the request itself, for example using `set.headers` to update headers.
120
+
Inside the trace callback, you can access `Context` of the request, and can mutate the value of the request itself, for example using `set.headers` to update headers.
121
121
122
-
This is useful when you need support API like Server-Timing.
122
+
This is useful when you need support an API like Server-Timing.
123
123
124
124

125
125
@@ -137,13 +137,13 @@ const app = new Elysia()
137
137
```
138
138
139
139
::: tip
140
-
Using `set` inside `trace` can affect performance, as Elysia as to defer to execution to next micro-tick.
140
+
Using `set` inside `trace` can affect performance, as Elysia defers the execution to the next micro-tick.
141
141
:::
142
142
143
143
## Skip
144
-
Sometime, `beforeHandle` or handler can throw can error, skipping the execution of some lifecycle.
144
+
Sometimes, `beforeHandle` or handler can throw an error, skipping the execution of some lifecycles.
145
145
146
-
By default if this happens, each life-cycle will be resolved automatically, you can track if the API is executed or not by using `skip` property
146
+
By default if this happens, each life-cycle will be resolved automatically, and you can track if the API is executed or not by using `skip` property
0 commit comments