Response time prediction of serverless

I am currently involved in the project which predicts the response time of serverless function. I am using openFaas platform and I used docker metrics (cpu,memory) as well as machine metrics as an input parameters. I want to use linear regression for the prediction, but I am getting those metrics before sending the request to function, which is not completely correct for predicting response time. And getting metrics after the request also is not correct.

So what do you think I can do in a such situation?