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
Understand your Angular application's real-world performance with [Firebase Performance Monitoring](https://firebase.google.com/docs/perf-mon). Performance Monitoring automatically provides a trace for **page load** when you add `AngularFirePerformanceModule` into your App Module's imports.
The page load trace breaks down into the following default metrics:
26
+
27
+
*[first paint traces](https://firebase.google.com/docs/perf-mon/automatic-web#first-paint) — measure the time between when the user navigates to a page and when any visual change happens
28
+
*[first contentful paint traces](https://firebase.google.com/docs/perf-mon/automatic-web#contentful-paint) — measure the time between when a user navigates to a page and when meaningful content displays, like an image or text
29
+
*[domInteractive traces](https://firebase.google.com/docs/perf-mon/automatic-web#domInteractive) — measure the time between when the user navigates to a page and when the page is considered interactive for the user
30
+
*[domContentLoadedEventEnd traces](https://firebase.google.com/docs/perf-mon/automatic-web#domContentLoaded) — measure the time between when the user navigates to a page and when the initial HTML document is completely loaded and parsed
31
+
*[loadEventEnd traces](https://firebase.google.com/docs/perf-mon/automatic-web#loadEventEnd) — measure the time between when the user navigates to the page and when the current document's load event completes
32
+
*[first input delay traces](https://firebase.google.com/docs/perf-mon/automatic-web#input-delay) — measure the time between when the user interacts with a page and when the browser is able to respond to that input
33
+
***Angular specific traces** - measure the time needed for `ApplicationRef.isStable` to be true, an important metric to track if you're concerned about solving Zone.js issues for proper functionality of NGSW and Server Side Rendering
34
+
35
+
## Manual traces
36
+
37
+
You can inject `AngularFirePerformance` to perform manual traces on Observables.
// measure the amount of time between the Observable being subscribed to and first emission (or completion)
15
48
this.afp.trace('getArticles'),
16
49
map(articles=>...)
17
50
);
18
51
}
19
52
```
20
53
21
-
`trace(name:string)` will trace the time it takes for your observable to either complete or emit it's first value. Beyond the basic trace there are three other operators:
22
-
23
-
### `traceComplete(name:string)`
54
+
### `trace(name:string)`
24
55
25
-
Traces the observable until the completion.
56
+
The most basic operator, `trace` will measure the amount of time it takes for your observable to either complete or emit its first value. Beyond the basic trace there are several other operators:
Traces the observable until the first emission or the first emission that matches the provided test.
64
+
Trace the observable until the first emission that fails the provided test.
34
65
35
-
##Advanced usage
66
+
### `traceUntilLast(name:string)`
36
67
37
-
### `trace$(...) => Observable<void>`
68
+
Trace the observable until completion.
38
69
39
-
`(name:string)`
40
-
`(name:string, options: TraceOptions)`
70
+
### `traceUntilFirst(name: string)`
41
71
42
-
Observable version of `firebase/perf`'s `.trace` method; the basis for `AngularFirePerfomance`'s pipes.
72
+
Traces the observable until the first emission.
43
73
44
-
`.subscribe()` is equivalent to calling `.start()`
45
-
`.unsubscribe()` is equivalent to calling `.stop()`
74
+
## Advanced usage
46
75
47
-
### `TraceOptions`
76
+
### Configuration via Dependency Injection
48
77
49
-
**TBD explain how each option is used by `.trace$`**
78
+
By default, `AngularFirePerformanceModule` traces your Angular application's time to `ApplicationRef.isStable`. `isStable` is an important metric to track if you're concerned about proper functionality of NGSW and Server Side Rendering. If you want to opt-out of the tracing of this metric use the `AUTOMATICALLY_TRACE_CORE_NG_METRICS` injection token:
0 commit comments