0
0
Microservicessystem_design~10 mins

Three pillars (metrics, logs, traces) in Microservices - Interactive Code Practice

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

Complete the code to collect system performance data using the correct pillar.

Microservices
system_data = collect_[1]()  # Collects numerical data like CPU usage
Drag options to blanks, or click blank then click option'
Alogs
Btraces
Calerts
Dmetrics
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing logs with metrics
Using traces instead of metrics
2fill in blank
medium

Complete the code to record detailed event information for debugging.

Microservices
write_[1]('User login failed due to invalid password')
Drag options to blanks, or click blank then click option'
Aalerts
Blogs
Ctraces
Dmetrics
Attempts:
3 left
💡 Hint
Common Mistakes
Using metrics instead of logs
Confusing traces with logs
3fill in blank
hard

Fix the error in the code to track the path of a request through services.

Microservices
trace = start_[1]('request-123')  # Tracks request flow across microservices
Drag options to blanks, or click blank then click option'
Atraces
Bmetrics
Clogs
Devents
Attempts:
3 left
💡 Hint
Common Mistakes
Using logs instead of traces
Confusing metrics with traces
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters logs by severity and extracts timestamps.

Microservices
{log['timestamp']: log['message'] for log in logs if log['severity'] [1] 'ERROR' and log['timestamp'] [2] 0}
Drag options to blanks, or click blank then click option'
A==
B>
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators
Mixing up equality and inequality
5fill in blank
hard

Fill all three blanks to build a trace span dictionary with service name, duration, and status check.

Microservices
span = {
  'service': '[1]',
  'duration_ms': [2],
  'status': 'success' if [3] < 500 else 'failure'
}
Drag options to blanks, or click blank then click option'
Aauth-service
Bresponse_time
Dpayment-service
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing service names
Using wrong variable for duration or status