Commit adf37892 authored by Santhosh Kumar's avatar Santhosh Kumar

cleanup code

parent b249d3bd
......@@ -13,7 +13,7 @@ RUN pip install -r requirements.txt
RUN pip install prometheus_client
RUN pip install psutil
EXPOSE 5000
EXPOSE 8000
# Define the command to run the function
CMD ["python", "/app/function.py"]
......@@ -62,6 +62,7 @@ def start_cpu_occupier(percentage):
return jsonify({'error': 'Invalid percentage, must be between 0 and 100'}), 400
memory_process = None
memory_block = None
def allocate_memory(memory_size):
try:
......@@ -112,7 +113,8 @@ def hello():
function_requests_total.inc()
for i in range(1000000):
for j in range(10000)
for j in range(10000):
pass
......@@ -192,9 +194,7 @@ def metrics():
output += "CPU Utilization: " + str(cpu_utilization) + "\n"
output += "Bytes Sent: " + str(bytes_sent) + "\n"
output += "Bytes Received: " + str(bytes_received) + "\n"
return output, 200, {"Content-Type": CONTENT_TYPE_LATEST}
return output, 200, {"Content-Type": CONTENT_TYPE_LATEST}
if __name__ == "__main__":
# Start Prometheus HTTP server to expose metrics
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment