0
0
Firebasecloud~10 mins

Performance monitoring in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize Firebase Performance Monitoring in your app.

Firebase
import { getPerformance } from 'firebase/performance';

const perf = [1](app);
Drag options to blanks, or click blank then click option'
AgetPerformance
BinitializePerformance
CstartPerformance
DenablePerformance
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function that does not exist like 'initializePerformance'.
Confusing initialization with enabling or starting.
2fill in blank
medium

Complete the code to trace a custom performance metric named 'load_time'.

Firebase
const trace = perf.[1]('load_time');
trace.start();
// ... some code ...
trace.stop();
Drag options to blanks, or click blank then click option'
AstartTrace
Ctrace
DtraceTrace
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like 'startTrace' or 'traceTrace'.
Confusing the method name with the variable name.
3fill in blank
hard

Fix the error in the code to correctly enable data collection for Performance Monitoring.

Firebase
import { getPerformance, [1] } from 'firebase/performance';

const perf = getPerformance(app);
[1](perf, true);
Drag options to blanks, or click blank then click option'
AactivatePerformanceCollection
BsetPerformanceCollectionEnabled
CstartPerformanceCollection
DenablePerformanceCollection
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect function names that do not exist.
Confusing enabling with starting or activating.
4fill in blank
hard

Fill both blanks to create a trace and add a custom metric named 'items_processed' with value 5.

Firebase
const trace = perf.[1]('process_trace');
trace.[2]('items_processed', 5);
trace.start();
trace.stop();
Drag options to blanks, or click blank then click option'
Atrace
BputMetric
CincrementMetric
DaddMetric
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that do not exist like 'addMetric' or 'incrementMetric' for adding a value metric.
Confusing the trace creation method with metric methods.
5fill in blank
hard

Fill all three blanks to create a trace, increment a metric named 'clicks', and start the trace.

Firebase
const trace = perf.[1]('click_trace');
trace.[2]('clicks');
trace.[3]();
Drag options to blanks, or click blank then click option'
Atrace
BincrementMetric
Cstart
DputMetric
Attempts:
3 left
💡 Hint
Common Mistakes
Using putMetric instead of incrementMetric when incrementing.
Forgetting to start the trace after creating it.