NTP-50779 | Added response time for apis for latency metrics
This commit is contained in:
@@ -3,6 +3,11 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 2.0.4 (2025-03-27)
|
||||||
|
|
||||||
|
**Note:** Added response time for APIs
|
||||||
|
|
||||||
|
|
||||||
## 2.0.3 (2025-02-19)
|
## 2.0.3 (2025-02-19)
|
||||||
|
|
||||||
**Note:** Version bump only for package @universal-call-sdk/common
|
**Note:** Version bump only for package @universal-call-sdk/common
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ export const apiHelper = async({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const requestStartTime = Date.now();
|
||||||
const response = await getFetchResponse(
|
const response = await getFetchResponse(
|
||||||
url,
|
url,
|
||||||
method,
|
method,
|
||||||
@@ -73,7 +74,7 @@ export const apiHelper = async({
|
|||||||
requestType,
|
requestType,
|
||||||
headers || {}
|
headers || {}
|
||||||
);
|
);
|
||||||
|
const requestEndTime = Date.now();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
@@ -87,6 +88,7 @@ export const apiHelper = async({
|
|||||||
data: {
|
data: {
|
||||||
requestKey,
|
requestKey,
|
||||||
response,
|
response,
|
||||||
|
time: requestEndTime - requestStartTime,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user