File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,24 @@ import { isNil } from "./lodash.js";
12
12
*/
13
13
14
14
/**
15
- * Manually track (async) function duration.
15
+ * The insight event is a tool for tracking the duration of (async) functions manually.
16
+ * By utilizing the insight event, you can gain access to a task or request-specific logger and
17
+ * obtain insights into the execution time of your functions.
16
18
*
17
- * By passing the event down through (async) functions, it facilitates a unified way to
18
- * have access to a task / request specific logger and insights in the duration of your
19
- * functions.
19
+ * How to use the Insight Event:
20
+ *
21
+ * Start by retrieving a root event. It can be created by calling {@link newEvent}
22
+ * and passing it a logger. When you use the {@link getApp} from @compas/store,
23
+ * it automatically adds a root event to `ctx.event`.
24
+ * In your tests you can use {@link newTestEvent}.
25
+ *
26
+ * You could pass the event object down through your (async) functions as an argument.
27
+ * This allows the insight event to associate the event with the specific task or request.
28
+ *
29
+ * Finally, you should stop the event for correct logging by calling {@link eventStop}.
30
+ * When the root event is stopped via {@link eventStop} it calculates the duration
31
+ * by subtracting the start time from the end time. the event can log the start
32
+ * and end times of the function execution if necessary.
20
33
*
21
34
* @example
22
35
* async function userList(event) {
You can’t perform that action at this time.
0 commit comments