Write an HTTP API endpoint that recommends the amount of CPU that should be allocated

Job ID: 32816993

Budget: $10 – $30 USD

Write an HTTP API endpoint that recommends the amount of CPU that should be allocated. The endpoint should be at the path /rightsize /cpu and should only accept POST requests.
The endpoint should accept the following:
1. Timeseries data for CPU utilization. The CPU data will be provided as positive integers measured in millicores. This timeseries represents CPU data sampled at some frequency over some period of time. Expect your endpoint to be able to handle large timeseries with over thousands of data points.
2. Disruption percentage. The percentage will be provided a decimal from 0 to 100 that denotes how many data points can fall above the allocated CPU. In other words, it is used to determine how often the Recommender can tolerate CPU utilization that exceeds the amount it is recommending. For example, given 1000 data points with a Disruption Percentage of 5%, 950 of the data points should fall below the line while 50 of the points should fall above it.

The POST body should be in the following format:
{
"timeSeries": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
"disruptionPercentage": 10
}
The API endpoint should respond with an integer threshold in the following format:
{
"threshold": 9
}
If the threshold returned is a decimal, round it up to the nearest integer. In the above example, only 10% of the data points exceed 9 millicores, therefore, the threshold returned is 9.
Related categories: Software Development Kubernetes