0
0
Rest APIprogramming~30 mins

SLA and uptime tracking in Rest API - Mini Project: Build & Apply

Choose your learning style9 modes available
SLA and uptime tracking
📖 Scenario: You work for a company that provides online services. Your team needs to track the uptime of different services to make sure they meet the Service Level Agreement (SLA).Each service has a name and a list of uptime percentages recorded daily. You want to calculate which services meet the SLA threshold.
🎯 Goal: Build a simple program that stores uptime data for services, sets an SLA threshold, calculates which services meet the SLA, and prints the results.
📋 What You'll Learn
Create a dictionary with service names as keys and lists of daily uptime percentages as values
Create a variable for the SLA threshold percentage
Use a dictionary comprehension to find services that meet or exceed the SLA threshold on average
Print the dictionary of services that meet the SLA
💡 Why This Matters
🌍 Real World
Tracking uptime is important for companies to ensure their services are reliable and meet promised standards.
💼 Career
Many IT and DevOps roles require monitoring service performance and reporting SLA compliance.
Progress0 / 4 steps
1
Create the uptime data dictionary
Create a dictionary called services_uptime with these exact entries: 'Email': [99.9, 99.7, 99.8], 'Storage': [99.5, 99.6, 99.4], 'Chat': [99.8, 99.9, 99.7]
Rest API
Need a hint?

Use curly braces to create a dictionary. Each key is a service name string, and each value is a list of floats.

2
Set the SLA threshold
Create a variable called sla_threshold and set it to 99.7
Rest API
Need a hint?

Just create a variable and assign the number 99.7 to it.

3
Find services meeting the SLA
Use a dictionary comprehension to create a dictionary called services_meeting_sla that includes only services from services_uptime whose average uptime is greater than or equal to sla_threshold. Use sum() and len() to calculate the average uptime for each service.
Rest API
Need a hint?

Use dictionary comprehension syntax: {key: value for key, value in dict.items() if condition}.

4
Print the services meeting SLA
Write a print() statement to display the services_meeting_sla dictionary.
Rest API
Need a hint?

Use print(services_meeting_sla) to show the final dictionary.