0
0
MLOpsdevops~10 mins

Platform observability and SLAs in MLOps - Interactive Code Practice

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

Complete the code to define a basic metric for monitoring model latency.

MLOps
model_latency = [1]('model_latency_seconds')
Drag options to blanks, or click blank then click option'
AHistogram
BGauge
CCounter
DSummary
Attempts:
3 left
💡 Hint
Common Mistakes
Using Counter which only counts events, not durations.
2fill in blank
medium

Complete the code to set an alert threshold for SLA violation when error rate exceeds 5%.

MLOps
if error_rate [1] 0.05:
    trigger_alert()
Drag options to blanks, or click blank then click option'
A<=
B<
C>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which triggers alert for low error rates.
3fill in blank
hard

Fix the error in the Prometheus query to calculate 99th percentile latency.

MLOps
histogram_quantile(0.99, sum(rate([1][5m])) by (le))
Drag options to blanks, or click blank then click option'
Amodel_latency_seconds_sum
Bmodel_latency_seconds_bucket
Cmodel_latency_seconds_count
Dmodel_latency_seconds
Attempts:
3 left
💡 Hint
Common Mistakes
Using raw latency or count metrics instead of buckets.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps model names to their error rates above 1%.

MLOps
{model: [1] for model, [2] in metrics.items() if error_rate > 0.01}
Drag options to blanks, or click blank then click option'
Aerror_rate
Clatency
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using latency or count instead of error_rate.
5fill in blank
hard

Fill all three blanks to filter logs for errors, extract timestamps, and count occurrences.

MLOps
error_counts = {log['[1]']: logs.count([2]) for log in logs if '[3]' in log['message']}
Drag options to blanks, or click blank then click option'
Atimestamp
Blog
Cerror
Dlevel
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'level' instead of 'error' for filtering.