Bird
Raised Fist0
Agentic AIml~20 mins

Latency monitoring per step in Agentic AI - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Latency Monitoring Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Interpreting latency output from a step monitoring tool
You run a latency monitoring command on a pipeline step and get this output:
Step: DataFetch
Latency: 120ms
Status: Success

What does this output tell you?
AThe DataFetch step has a latency of 120 microseconds and failed.
BThe DataFetch step failed after 120 seconds.
CThe entire pipeline took 120 milliseconds to run.
DThe DataFetch step took 120 milliseconds to complete successfully.
Attempts:
2 left
💡 Hint
Latency is usually measured in milliseconds and indicates duration.
Configuration
intermediate
2:00remaining
Configuring latency monitoring for a pipeline step
You want to configure latency monitoring for a step named 'ProcessData' using a YAML config. Which snippet correctly sets a threshold of 200ms to alert if exceeded?
A
steps:
  - name: ProcessData
    latency:
      max_time: 0.2
      alert_on_exceed: true
B
steps:
  - name: ProcessData
    latency_monitor:
      alert_threshold: 200ms
      enabled: yes
C
steps:
  - name: ProcessData
    latency_monitor:
      threshold_ms: 200
      alert: true
D
steps:
  - name: ProcessData
    monitor_latency:
      threshold: 200
      alert_enabled: true
Attempts:
2 left
💡 Hint
Look for correct key names and units in milliseconds.
Troubleshoot
advanced
2:00remaining
Diagnosing missing latency data in monitoring logs
You notice that latency data for step 'Analyze' is missing in your monitoring logs. Which is the most likely cause?
AThe 'Analyze' step completed too quickly to record latency.
BThe latency monitoring agent was not enabled for the 'Analyze' step.
CThe monitoring logs are corrupted and missing all data.
DThe 'Analyze' step is running on a different server without network access.
Attempts:
2 left
💡 Hint
Check if monitoring is enabled per step.
🔀 Workflow
advanced
2:30remaining
Optimizing pipeline based on latency monitoring data
Your latency monitoring shows step 'Transform' consistently takes 500ms, which is double the threshold. What is the best next step?
AInvestigate the 'Transform' step code and resources to identify bottlenecks.
BIgnore the latency since the step still completes successfully.
CIncrease the latency threshold to 600ms to avoid alerts.
DDisable latency monitoring for the 'Transform' step to reduce overhead.
Attempts:
2 left
💡 Hint
High latency should trigger investigation to improve performance.
Best Practice
expert
3:00remaining
Implementing latency monitoring with minimal performance impact
Which approach best balances accurate latency monitoring per step with minimal impact on pipeline performance?
AUse asynchronous logging of latency data after step completion to avoid blocking the step.
BAdd synchronous latency measurement code inside each step, logging before and after execution.
CCollect latency data only once per pipeline run to reduce overhead.
DDisable latency monitoring during peak hours to improve performance.
Attempts:
2 left
💡 Hint
Consider how monitoring affects step execution time.

Practice

(1/5)
1. What is the main purpose of latency monitoring per step in a process?
easy
A. To reduce the total number of users
B. To increase the number of steps in the process
C. To find slow parts in the process and improve speed
D. To add more features to the system

Solution

  1. Step 1: Understand latency monitoring

    Latency monitoring measures how long each step in a process takes.
  2. Step 2: Identify the goal of monitoring

    The goal is to find slow steps to improve overall speed and user experience.
  3. Final Answer:

    To find slow parts in the process and improve speed -> Option C
  4. Quick Check:

    Latency monitoring = Find slow parts [OK]
Hint: Latency monitoring finds slow steps to speed up process [OK]
Common Mistakes:
  • Thinking it adds more steps
  • Confusing with user count
  • Assuming it adds features
2. Which code snippet correctly measures latency for a step using start and end time calls?
easy
A. start_time = get_time() // step code end_time = get_time() latency = end_time - start_time
B. start_time = get_time() latency = start_time end_time = get_time()
C. latency = get_time() // step code latency = latency - get_time()
D. end_time = get_time() // step code start_time = get_time() latency = end_time - start_time

Solution

  1. Step 1: Identify correct order of time calls

    Start time must be recorded before the step, end time after the step.
  2. Step 2: Calculate latency as difference

    Latency is end_time minus start_time to get duration.
  3. Final Answer:

    start_time = get_time()\n// step code\nend_time = get_time()\nlatency = end_time - start_time -> Option A
  4. Quick Check:

    Latency = end - start [OK]
Hint: Latency = end time minus start time [OK]
Common Mistakes:
  • Subtracting start from end incorrectly
  • Assigning latency before step runs
  • Swapping start and end times
3. Given this code snippet measuring latency per step, what is the output of print(latencies)?
latencies = []
for step in range(3):
    start = get_time()
    do_work(step)
    end = get_time()
    latencies.append(end - start)
print(latencies)
Assume do_work(step) takes 1, 2, and 3 seconds respectively.
medium
A. [1, 2, 3]
B. [3, 2, 1]
C. [0, 0, 0]
D. Error: get_time() undefined

Solution

  1. Step 1: Understand loop and timing

    Each loop iteration measures time before and after do_work(step).
  2. Step 2: Calculate latencies per step

    Since do_work takes 1, 2, and 3 seconds, latencies list will be [1, 2, 3].
  3. Final Answer:

    [1, 2, 3] -> Option A
  4. Quick Check:

    Latencies match step durations [OK]
Hint: Latency list matches step durations in order [OK]
Common Mistakes:
  • Reversing latency order
  • Assuming zero latency
  • Ignoring step durations
4. You wrote this code to measure latency per step but get wrong results:
start = get_time()
do_step1()
end = get_time()
latency1 = end - start

start = get_time()
do_step2()
latency2 = end - start
What is the error causing wrong latency2?
medium
A. start time is recorded after do_step2
B. end time is not updated before calculating latency2
C. latency1 calculation is incorrect
D. do_step1 and do_step2 are swapped

Solution

  1. Step 1: Check timing for latency2

    For latency2, end time is not updated after do_step2, so it uses old end value.
  2. Step 2: Identify missing end time update

    Must call end = get_time() after do_step2 before calculating latency2.
  3. Final Answer:

    end time is not updated before calculating latency2 -> Option B
  4. Quick Check:

    Update end time after step [OK]
Hint: Always update end time after each step [OK]
Common Mistakes:
  • Forgetting to update end time
  • Calculating latency before step ends
  • Mixing start and end times
5. You want to monitor latency per step in a multi-step process and alert if any step exceeds 2 seconds. Which approach correctly implements this?
hard
A. Ignore timing and alert randomly to check system
B. Measure total process time only and alert if total > 2 seconds
C. Only measure first step latency and alert if > 2 seconds
D. Measure start and end time per step, calculate latency, and trigger alert if latency > 2

Solution

  1. Step 1: Understand requirement for per-step latency

    We must measure each step's latency individually to detect slow steps.
  2. Step 2: Implement alert condition per step

    Calculate latency per step and trigger alert if latency exceeds 2 seconds.
  3. Final Answer:

    Measure start and end time per step, calculate latency, and trigger alert if latency > 2 -> Option D
  4. Quick Check:

    Alert on per-step latency > 2 seconds [OK]
Hint: Alert when any step latency exceeds threshold [OK]
Common Mistakes:
  • Measuring only total time
  • Checking only first step
  • Ignoring timing data