coding-latte / codinglatte.com-comments

Comments on Coding Latte
0 stars 0 forks source link

posts/angular/logging-http-response-times-angular/ #13

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

Logging HTTP Response Times in Angular

In this post, we will look at how you can measurethe time it takes to send and receive HTTP responses, from the frontend and logging them.

https://codinglatte.com/posts/angular/logging-http-response-times-angular/

Sebastian-Haehnlein commented 4 years ago

why do you send startTimestamp with headers? its closure-like, you can use startTimestamp directly

pathikvejani commented 4 years ago

How to record response time for more than 1 API calls on one page? I have 3 API calls. I want to sum of all 3 response time and show in front-end. Any suggestion?

mainawycliffe commented 4 years ago

Are you running them sequentially or in parallel?

pathikvejani commented 4 years ago

parallel.

mainawycliffe commented 4 years ago

You could possibly use the CombineLatest creation operator to bundle the observables, and this will give you access to the time taken by each request, in the header and then depending on how you want to handle it, you can calculate how long it took to execute the request i.e. take the earliest start timestamp and the latest timestamp and subtract the two.